按钮栏不会粘在屏幕底部

2024-01-23

我试图将我创建的按钮栏放在每个屏幕的底部。我很容易就成功地完成了第一个屏幕。

现在我尝试把它放到其他屏幕上,但似乎无法粘在屏幕底部。当我查看 hiearchyviewer 时,看起来包裹在我的布局和按钮栏周围的相对布局并没有填充整个屏幕,但它的高度设置为填充父级。

谁能帮助我指出我哪里出错了?

这是我使用的 XML:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:orientation="vertical">
    <TableLayout android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:padding="5pt" android:id="@+id/table"
        android:stretchColumns="1">
        <TableRow>
            <TextView android:text="@string/Arbeiderbediende"
                android:id="@+id/txtArbeiderBediende" android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </TableRow>

        <TableRow android:gravity="center">
            <RadioGroup android:layout_width="fill_parent"
                android:layout_height="wrap_content" android:orientation="horizontal"
                android:id="@+id/group1">

                <RadioButton style="@style/RadioButton"
                    android:layout_width="wrap_content" android:id="@+id/rbArbeider"
                    android:text="@string/Arbeider" android:layout_height="wrap_content"
                    android:paddingLeft="18pt" />

                <RadioButton style="@style/RadioButton"
                    android:layout_width="wrap_content" android:id="@+id/rbBediende"
                    android:text="@string/Bediende" android:layout_height="wrap_content"
                    android:layout_marginLeft="20pt" android:paddingLeft="18pt" />
            </RadioGroup>
        </TableRow>

        <TableRow android:gravity="center" android:paddingTop="5dip">
            <TextView android:text="@string/OverzichtFuncties"
                android:id="@+id/txtFuncties" android:layout_width="0dip"
                android:layout_weight="1" android:layout_height="wrap_content" />

            <Spinner android:layout_height="wrap_content" style="Spinner"
                android:layout_width="0dip" android:layout_weight="2"
                android:id="@+id/cmbFuncties" />
        </TableRow>

        <TableRow android:gravity="center" android:paddingTop="5dip">
            <TextView android:text="@string/Regio" android:id="@+id/txtRegio"
                android:layout_width="0dip" android:layout_weight="1"
                android:layout_height="wrap_content" />

            <Spinner android:layout_height="wrap_content"
                android:layout_width="0dip" android:layout_weight="2" android:id="@+id/cmbRegio" />
        </TableRow>

        <TableRow android:gravity="center" android:paddingTop="5dip">
            <TextView android:text="@string/Opleiding" android:id="@+id/txtOpleidingsniveau"
                android:layout_width="0dip" android:layout_weight="1"
                android:layout_height="wrap_content" />

            <Spinner android:layout_height="wrap_content"
                android:layout_width="0dip" android:layout_weight="2"
                android:id="@+id/cmbOpleidingsniveau" />
        </TableRow>

        <Button android:text="@string/VindJobButton" android:id="@+id/btnFindJob"
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            android:layout_marginTop="10dip" />


    </TableLayout>

    <stage.accent.Toolbar android:layout_width="fill_parent"
        android:layout_height="70dip" android:layout_alignParentBottom="true"
        android:layout_below="@+id/table" />
</RelativeLayout>

这就是我达到的结果,也是我想要得到的结果


如果您希望按钮栏始终在屏幕底部可见并且不随内容滚动,您可能需要切换RelativeLayout and ScrollView标签,并将您的按钮栏移动到您的第一个子元素RelativeLayout, the ScrollView成为第二个:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
    <stage.accent.Toolbar android:id="id/buttonBar" android:layout_width="fill_parent"
        android:layout_height="70dip" android:layout_alignParentBottom="true" />
    <ScrollView android:layout_above="@+id/buttonBar"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
        <TableLayout android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:padding="5pt" android:id="@+id/table"
            android:stretchColumns="1">
            <TableRow>
                <TextView android:text="@string/Arbeiderbediende"
                    android:id="@+id/txtArbeiderBediende" android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
            </TableRow>
            <TableRow android:gravity="center">
                <RadioGroup android:layout_width="fill_parent"
                    android:layout_height="wrap_content" android:orientation="horizontal"
                    android:id="@+id/group1">

                    <RadioButton style="@style/RadioButton"
                        android:layout_width="wrap_content" android:id="@+id/rbArbeider"
                        android:text="@string/Arbeider" android:layout_height="wrap_content"
                        android:paddingLeft="18pt" />

                    <RadioButton style="@style/RadioButton"
                        android:layout_width="wrap_content" android:id="@+id/rbBediende"
                        android:text="@string/Bediende" android:layout_height="wrap_content"
                        android:layout_marginLeft="20pt" android:paddingLeft="18pt" />
                </RadioGroup>
            </TableRow>
            <TableRow android:gravity="center" android:paddingTop="5dip">
                <TextView android:text="@string/OverzichtFuncties"
                    android:id="@+id/txtFuncties" android:layout_width="0dip"
                    android:layout_weight="1" android:layout_height="wrap_content" />

                <Spinner android:layout_height="wrap_content" style="Spinner"
                    android:layout_width="0dip" android:layout_weight="2"
                    android:id="@+id/cmbFuncties" />
            </TableRow>
            <TableRow android:gravity="center" android:paddingTop="5dip">
                <TextView android:text="@string/Regio" android:id="@+id/txtRegio"
                    android:layout_width="0dip" android:layout_weight="1"
                    android:layout_height="wrap_content" />

                <Spinner android:layout_height="wrap_content"
                    android:layout_width="0dip" android:layout_weight="2" android:id="@+id/cmbRegio" />
            </TableRow>
            <TableRow android:gravity="center" android:paddingTop="5dip">
                <TextView android:text="@string/Opleiding" android:id="@+id/txtOpleidingsniveau"
                    android:layout_width="0dip" android:layout_weight="1"
                    android:layout_height="wrap_content" />

                <Spinner android:layout_height="wrap_content"
                    android:layout_width="0dip" android:layout_weight="2"
                    android:id="@+id/cmbOpleidingsniveau" />
            </TableRow>
            <Button android:text="@string/VindJobButton" android:id="@+id/btnFindJob"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:layout_marginTop="10dip" />
        </TableLayout>
    </ScrollView>
</RelativeLayout>

这样你就能够实现你想要的:

portrait and landscape

按钮栏将始终位于屏幕底部。

通过滚动内容,您也可以看到它的最后一点,它不会隐藏在按钮栏后面:

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

按钮栏不会粘在屏幕底部 的相关文章

随机推荐

  • 将分类数据传递给 Sklearn 决策树

    有几篇关于如何将分类数据编码到 Sklearn 决策树的文章 但从 Sklearn 文档中 我们得到了这些 决策树的一些优点是 能够处理数值数据和分类数据 其他技术通常专门用于分析仅具有一种变量类型的数据集 请参阅算法以获取更多信息 但运行
  • ManagedObjectContext 为零

    我正在尝试将核心数据添加到现有项目中 我有 1 添加了核心数据框架 2 向AppDelegate添加访问器和属性 3 创建数据模型文件 现在当我尝试打电话时NSManagedObjectContext context self manage
  • Ruby:通过使用模块扩展 File 来处理文件格式

    一旦我有一个File http ruby doc org core 2 3 1 File html例如 我想检查它是否匹配文件格式并且extend http ruby doc org core 2 3 1 Object html metho
  • Java 的 PDF 生成库 [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我知道以前有人问过这个问题 但我仍然不确定在我当前的项目中使用哪个 PDF 生成框架 我的要求 即时生
  • ScrollView 内 ListView 的滚动问题

    这是概念性的场景 不包括线性布局 ScrollView Button Checkboxes Spinner ListView full size non scrolling AdMob advert 即滚动窗格 顶部有一个过滤 UI 后面是
  • 冻结 Python Pandas 的问题

    我刚刚从 Python 2 7 升级到 3 6 我有一个相当大的带有 GUI 的脚本 我已使用 pyinstaller 将其冻结为 exe 文件 我现在对 py 脚本做了一些更改 在我冻结它之前它可以与新的 Python 版本一起使用 但是
  • 是否有内置函数可以清除所有变量值

    我正在寻找一种方法来清除 Perl 程序中的所有数组 目前 我正在调用一个显式 重置 所有数组的子例程 sub clear arrays array1 array2 array3 这迫使我找到程序中的所有数组并在子例程中逐字引用它们 我查看
  • 在 BigQuery 中透视重复字段

    我的架构看起来像这样 userid string timestamp integer params nested repeated field with 2 fields name string possible values a b c
  • 如何在 Spring Boot 中从未经授权的响应中删除变量

    当涉及到检查用户未经授权时 我有这样的响应 我有可能从未经授权的响应中删除路径吗 因为它没有为用户提供有价值的信息 timestamp 2021 03 18T09 16 09 699 0000 status 401 error Unauth
  • 如何从java调用GraphViz

    如何从java调用GraphViz以及如何使用java调用GraphViz函数 为了访问 GraphViz 库来构建点图 需要包含哪些必要的 jar 文件 有没有生成点图的示例程序 Check this http www loria fr
  • Azure kubernetes - python 读取configmap?

    我正在尝试对 python 应用程序进行 Dockerize 并希望从 configmap 中读取配置设置 如何在Python中读取configmap 使用配置文件创建 configMap kubectl create configmap
  • Xcode 4:构建失败,没有问题

    该应用程序在模拟器中运行良好 可以构建并运行 当我连接我的设备 运行 iOS 4 3 的 iPhone 3GS 并以 iPhone 为目标时 结果是 构建失败 和 没有问题 查看构建结果窗口 一切都是绿色的 有一个复选标记 包括构建失败通知
  • 无法编译json框架

    我使用 json framework 来解析 json 但是当我编译时出现以下错误 xxx SBJsonStreamParser h xxx SBJsonStreamParser h 105 错误 在 unsafe unretained 之
  • IBM Data Studio 无法浏览 SAMPLE (DB2 Express-C) 上的数据

    我无法浏览 SAMPLE DB 上的数据 设置如下 Windows 7 64 位 PRO IBM DB2 Express C 10 5 500 107 最新 IBM Data Studio 版本 4 1 1 管理安装 使用 IBM Inst
  • 检测到潜在危险的 Request.Form 值

    我有一个带有 wmd 编辑器的表单 输入文本区域使用以下方式呈现 每次我提交表格时我都会得到A potentially dangerous Request Form value was detected from the client 我尝
  • 使用 ssh2 exec 执行多个命令

    我有一个运行一个命令的脚本 根据该结果 我可以运行下一个命令 步骤 运行第一个脚本 它将我置于全局中 然后从全局中我将运行下一个命令 第一个命令 stream ssh2 exec connection 配置全局 在这个结果之后我应该运行这个
  • Firebase部署404找不到index.html

    我在跑firebase init它正在创造firebase json firebase json位于应用程序根目录中 指向我的公共目录app 看这里 firebase json firebase harrison public app ig
  • 如何在spring中使用jdbcTemplate传递多个值进行查询

    在我的 Spring Hibernate 应用程序中 我将所有 sql 查询都放在一个 common queries xml 文件中 其中某些查询需要 2 到 3 个参数 如下所示
  • HTML 查找并停止显示子表

    我已经这样做了 table tbody tr th row1 th td w td tr tr th row2 th td x td tr tbody tbody tr th row1 th td y td tr tr th row2 th
  • 按钮栏不会粘在屏幕底部

    我试图将我创建的按钮栏放在每个屏幕的底部 我很容易就成功地完成了第一个屏幕 现在我尝试把它放到其他屏幕上 但似乎无法粘在屏幕底部 当我查看 hiearchyviewer 时 看起来包裹在我的布局和按钮栏周围的相对布局并没有填充整个屏幕 但它