【发布时间】:2014-08-05 01:27:24
【问题描述】:
我一直在尝试找到一种方法将我的按钮移动到我的 xml 文件的下半部分。目前他们处于上半区。
我正在尝试遵循此处找到的此解决方案,但恐怕它不适用。
Put buttons at bottom of screen with LinearLayout?
我的buttons.xml是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1">
<TableLayout android:id="@+id/tableLayout1"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<Button
android:id="@+id/block_button"
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_weight="0.09"
android:background="#ff5ac3ff"
android:drawableLeft="@drawable/ic_action"
android:gravity="center_horizontal|center_vertical"
android:text="@string/block_apps"
android:textSize="22sp" />
<Button
android:id="@+id/security_settings_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff5ac3ff"
style="?android:attr/borderlessButtonStyle"
android:layout_weight="0.09"
android:drawableLeft="@drawable/ic_settings"
android:gravity="center_horizontal|center_vertical"
android:text="@string/security_settings"
android:textSize="22sp"/>
<Button
android:id="@+id/blacklist_whitelist_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff5ac3ff"
style="?android:attr/borderlessButtonStyle"
android:drawableLeft="@drawable/ic_blacklist_red"
android:gravity="center_horizontal|center_vertical"
android:text="@string/blacklist_whitelist"
android:textSize="22sp"
android:layout_weight="0.09"/>
</LinearLayout>
【问题讨论】:
-
我建议你将整个布局分成6个相等的
LinearLayouts,然后在最后三个布局中设置按钮..你可以问我是否需要任何帮助..跨度> -
我确定这不是唯一的解决方案,对吧?但是是的,我们将不胜感激
-
我已将其添加为我的答案..
标签: android xml android-layout