0
これは作成したXMLファイルです。 LinearLayout
の身長を設定できません。私はLinearLayout
の向きを水平に設定しました。layout_weight
を使用して、高さをLinearLayout
に設定しました。アンドロイドアプリのネストされたレイアウトが機能していません
しかし、TextView
の高さをmatch_parent
に設定しても機能しません。
<RelativeLayout 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:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
tools:context=".MainActivity"
android:weightSum="3">
<LinearLayout
android:id="@+id/a"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="2"/>
</LinearLayout>
<LinearLayout
android:id="@+id/b"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_below="@id/a">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="3"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="4"/>
</LinearLayout>
<LinearLayout
android:id="@+id/c"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_below="@id/b">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="5"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="6"/>
</LinearLayout>
</RelativeLayout>
「機能しない」と「機能しない」とはどういう意味ですか? – Chris