2

xml の最上位の親である relativelayout 内の下部に線形レイアウトを配置する必要があります。これどうやってするの?

私を助けてください。

 <?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:background="@drawable/background"
android:orientation="vertical" >
<RelativeLayout .......   <<--- this should occupy total available space
</Relativelayout
 <Linearlayout .......     <<-- this should place at bottom always with height 50dp
 </LineaLayout>
 </ReltiveLayout>
4

4 に答える 4

17

これを試してください:

<LinearLayout android:layout_alignParentBottom="true" android:layout_height="50dp" android:layout_width="wrap_content">
</LinearLayout>

上記の属性からxmlの下部に配置できます。

于 2012-06-02T09:56:45.600 に答える
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"      >
<RelativeLayout
    android:id="@+id/relativeLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentTop="true"
    android:background="#ff00ff00"
    android:layout_centerHorizontal="true" >
</RelativeLayout>
<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="wrap_content"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:background="#ffff0000"
    android:layout_alignParentRight="true" >

</LinearLayout>

于 2012-06-02T10:26:49.490 に答える
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:minHeight="?android:attr/listPreferredItemHeight" >
 <RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="119dp" >
 </RelativeLayout>

 <LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true" >
 </LinearLayout>

</RelativeLayout>
于 2012-06-02T10:00:28.947 に答える