Articles → Android → Linear Layout In Android
Linear Layout In Android
Purpose
Syntax
<LinearLayout
android:layout_width=""
android:layout_height=""
android:orientation=" "></LinearLayout>
Layout_Weight Attribute
Gravity Attribute
<LinearLayout
android:layout_width="400dp"
android:layout_height="200dp"
android:gravity="bottom"
android:orientation="horizontal"><Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="10"
android:text="Button" /><Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="4"
android:text="Button" /></LinearLayout>
Click to Enlarge
Match_Parent Attribute
Nested Layout
Click to Enlarge
Click to Enlarge