在屏幕右侧的按钮中添加一个按钮

问题描述

| 我有以下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\"/>
现在,我想添加一个按钮,在屏幕的右下方显示它。 谁能帮我解决该怎么做?     

解决方法

        首先删除线性布局,使用相对布局。对于按钮,请使用以下命令 android:layout_alignParentBottom = \“ true \”和android:layout_alignParentRight = \“ true \”     ,        一种可能的解决方案应该是:添加一个RelativeLayout作为根布局,并将按钮放置在LinearLayout后面,并带有layout_below和layout_right属性(以LinearLayout作为参考)。     ,        尝试使用以下代码
<?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>
谢谢 迪帕克