線形レイアウトを学習していますが、混乱しています。
<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"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:layout_weight=".33"/>
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button"
android:layout_weight=".33"/>
<Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button"
android:layout_weight=".3"/>
</LinearLayout>
これらのコードには 3 つの要素があります。
- TextView 2.Button1 3.Button2
線形レイアウトの向きは垂直で、1 つの重み値のみを調整して同じ重みを与えています。
今、私は与えている垂直方向に
android:layout_width="fill_parent"
android:layout_height="wrap_content"
したがって、高さと幅の両方を埋めています。
しかし、水平レイアウトを使用して次のように書いている場合
android:layout_height="fill_parent"
android:layout_width="wrap_content"
幅を埋めますが、高さを埋めません
Android:layout_height="fill_parent" を与える代わりに、なぜ高さを埋めないのですか?