私は次のようなAndroidアプリケーションを持っています:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/toplayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.90" >
<Button
android:id="@+id/button_1_of_10"
android:layout_width="70dip"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="@string/text_0x1701" />
<Button
android:id="@+id/button_2_of_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="@+id/button_1_of_10"
android:layout_below="@+id/button_1_of_10"/>
<!--Another 8 buttons-->
<RelativeLayout
android:id="@+id/contentpane"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/button_1_of_10" >
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/actionbuttonslayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.10">
</RelativeLayout>
</LinearLayout>
すべてのボタンが同じ高さを維持しながら、上部からフッターまでの高さ全体(0.1の重み付きRelativeLayout)を埋めるために10個のボタンが必要です。ただし、LinearLayoutのlayout_weightに相当するものがあるかどうかを知りたいのですが、RelativeLayoutsの場合は、LinearLayoutsにネストされた重みを設定するのはパフォーマンスが悪いためです。まだ試すことがあるので、他の解決策を探しているわけではありませんが、これが可能かどうか知りたいですか?
明確にするために、私の質問は次のとおりです。RelativeLayoutに同じ高さのボタンをいくつでも配置し、同時に使用可能なすべてのスペースを埋めることはできますか?