0

相対的なレイアウトの中央から下のスペースを取るようにレイアウトを設計する方法。

|--------------------------|
|                          |
|                          |
|                          |
|                          |
|                          |
|--------------------------|
|            |             |
|      this will be        |
|       content            |
|            |             |
|            |             |
|--------------------------|

<RelativeLayout>[another_layout should be here]</RelativeLayout>

そのため、another_layoutは RelativeLayout の中央から開始し、そのレイアウトの下部まで埋めます。

4

3 に答える 3

4

相対レイアウト内にある線形レイアウトでコンテンツをラップしてから、android:layout_alignParentBottom="true" を設定できます。

于 2013-08-04T21:22:34.207 に答える
2
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- Invisible View that will hold the position -->
    <View
        android:id="@+id/stub"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_centerInParent="true"/>

    <!-- Content below -->
    <TextView
        android:layout_below="@id/stub"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:text="@string/something" />

</RelativeLayout>
于 2013-08-04T21:55:39.773 に答える