android线性布局设置控件固定在底部,android – 如何使用线性布局将按钮设置到屏幕底部...

我刚开始使用

Android并拥有以下代码.我想在屏幕底部显示三个按钮而不更改为相对布局.我尝试设置内部线性布局的layout_weight和gravity,但这会将按钮放在手机三个菜单按钮后面的底部.如何在菜单按钮上方显示它们?任何帮助,将不胜感激.

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical">

android:id="@+id/search_box"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="@string/search_box" />

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:gravity="center_horizontal"

android:paddingTop="80dp"

android:text="@string/welcome"

android:textSize="24sp" />

style="?android:attr/buttonBarStyle"

android:layout_width="match_parent"

android:layout_height="0dp"

android:layout_weight="1"

android:gravity="bottom"

android:orientation="horizontal">

style="?android:attr/buttonBarButtonStyle"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:text="@string/buttonB1" />

style="?android:attr/buttonBarButtonStyle"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:text="@string/buttonB2" />

style="?android:attr/buttonBarButtonStyle"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1"

android:text="@string/buttonB3" />

左图显示了我想要移动到底部的按钮.右图显示我尝试这样做但按钮最终部分位于系统菜单按钮后面.

2415bc29e7df4de1d747aac286a00c61.png

79248979beb4663502cb67ad77331499.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值