LinearLayout (Linear layout):
: Layout/activity_main.xml
<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" >
<linearlayout
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
android:orientation= "Horizontal" >
<textview android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "User name:"/>
<edittext android:layout_width= "0DP"
android:layout_height= "Wrap_content"
Android:hint= "Please enter 1-10 characters"
android:layout_weight= "1"/>
</LinearLayout>
<linearlayout
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
android:orientation= "Horizontal" >
<textview android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Password:"/>
<edittext android:layout_width= "0DP"
android:layout_height= "Wrap_content"
Android:hint= "Please enter 1-10 characters"
android:layout_weight= "1"
Android:password= "true"/>
</LinearLayout>
<linearlayout
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
android:orientation= "Horizontal"
android:layout_margintop= "20DP" >
<view android:layout_width= "0DP"
android:layout_height= "30DP"
android:layout_weight= "1"
/>
<button
Android:layout_width= "Wrap_content"
android:layout_height= "30DP"
android:background= "@drawable/BTN_BG"
android:drawableleft= "@drawable/login32x32"
android:text= "Landing"/>
<view android:layout_width= "0DP"
android:layout_height= "30DP"
android:layout_weight= "1"
/>
<button android:text= "Exit"
android:drawableleft= "@drawable/exit32x32"
android:background= "@drawable/BTN_BG"
Android:layout_width= "Wrap_content"
android:layout_height= "30DP"/>
<view android:layout_width= "0DP"
android:layout_height= "30DP"
android:layout_weight= "1"
/>
</LinearLayout>
</LinearLayout>
Effect:
650) this.width=650; "src=" http://img.blog.csdn.net/20141121093009079 "/>
This article from "Follow the heart of the other side" blog, declined reprint!
Android linear layout LinearLayout and weight weights used