2011-05-30 162 views
1

我有以下的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

你是指在列表的右下方还是右边? – 2011-05-30 12:30:06

+0

是的,这是错误的,我的意思是屏幕的右下方 – George32x 2011-05-30 12:34:18

回答

1

可能的解决方案应该是:添加一个RelativeLayout作为根布局,并将该按钮放在LinearLayout之后,属性为layout_below和layout_right(LinearLayout作为参考)。

2

先去除线性布局,使用相对layout.for按钮使用下面的命令

机器人:layout_alignParentBottom = “真”机器人:layout_alignParentRight = “真

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> 

感谢 迪帕克

+0

其实我希望我的按钮从listaview2下来 – George32x 2011-05-30 13:23:17