我有以下的android布局,在屏幕上显示脚趾列表视图,一个在左侧,另一个在右侧。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1" android:id="@+id/ListView01"/>
<ListView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="3" android:id="@+id/ListView02"/>
现在我想添加一个显示在屏幕右下角的按钮。 任何人都可以帮我解决这个问题吗?
答案 0 :(得分:2)
首先删除线性布局,使用相对布局。按钮使用以下命令
android:layout_alignParentBottom =“true”和 android:layout_alignParentRight =“true ”
答案 1 :(得分:1)
一个可能的解决方案应该是:以根布局添加RelativeLayout并将按钮放在LinearLayout之后,其属性为layout_below和layout_right(LinearLayout作为参考)。
答案 2 :(得分:0)
尝试使用以下代码
<?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="horizontal"
android:background="#ffffff"
>
<Button
android:id="@+id/click"
android:layout_width="100dip"
android:layout_height="60dip"
android:text="Click"
android:layout_alignParentRight="true"
/>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ListView02"
android:background="#00ff00"
android:layout_toLeftOf="@+id/click"
/>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ListView01"
android:background="#000000"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/ListView02"
/>
</RelativeLayout>
由于 迪帕克