LINE Layout使用
4133 ワード
個人的な理解:
1)直線レイアウトは入れ子の多すぎる層数を提案しないので、システムのロードが遅すぎます。
2)リニアレイアウトは、orentationによりレイアウトのレベルを実現しますか?それとも垂直を実現しますか?
3)ラyout_を通過するweightはこのコントロールの全方向に占める割合を実現します。
android:layout_weight=「1」1
オブジェクトの占有比重の付与値を表し、デフォルトでは0という意味で、どれだけ大きいかを表示する必要があるビューがどれだけ大きいかを意味します。2以上の場合、オブジェクトの占有率を表します。例えば、2つのテキスト編集ボックスの最初のweight=1、2番目のweight=2はスクリーンに表示されます。テキストボックス2の占有率は1/3テキストボックス1の占有率は2/3です。
android:layout_マーティンLeft=「2 dp」は左マージンから2つの独立したデバイスのピクセルです。
線形配置:
<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">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3">
<TextView
android:text="@string/input_str"
android:textSize="15pt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
>
<Button
android:id="@+id/activity2_btn11"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="20dp"
android:text="@string/test_Activtity1"
/>
<EditText
android:id="@+id/activit2_editText1"
style="@style/AppTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text|none|textCapWords"
android:text="@string/activity_btn1_text"
>
<requestFocus />
</EditText>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<Button
android:id="@+id/activity2_button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test_Activtity1"
/>
<EditText
android:id="@+id/activity2_editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="text|none|textCapWords"
android:ems="10"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>