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


Posted By  -  Karan Gupta
 
Posted On  -  Monday, October 28, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250