Android-レイアウト(LinearLayout)学習
1567 ワード
リニアレイアウトは、すべてのサブビューが一方向、水平、または垂直に整列するビューグループです.
レイアウトの方向をandroid:orientationプロパティで指定できます.、
Tips:注意点:androidのLinearLayoutが使用されている場合、1行が埋まると自動的に改行されません.
複数のものは表示されません.
コード:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="16dip"
android:paddingRight="16dip" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/to" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/subject" />
<EditText
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top"
android:hint="@string/message" />
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/send" />
</LinearLayout>
のスクリーンショットは次のとおりです.