In the app, we often see a split line in the layout, directly on the code:
1 <?XML version= "1.0" encoding= "Utf-8"?>2 <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent"5 android:orientation= "vertical">6 7 <Button8 Android:id= "@+id/button1"9 Android:layout_width= "Wrap_content"Ten Android:layout_height= "Wrap_content" One Android:text= "BTN1" /> A - <ImageView - Android:layout_width= "Fill_parent" the Android:layout_height= "2DP" - Android:background= "#e5e5e5" - /> - + <Button - Android:id= "@+id/button2" + Android:layout_width= "Wrap_content" A Android:layout_height= "Wrap_content" at Android:text= "BTN2" /> - - <LinearLayout - android:orientation= "vertical" - Android:layout_width= "Match_parent" - Android:layout_height= "0.5DP" in Android:background= "#e5e5e5"> - </LinearLayout> to + - <Button the Android:id= "@+id/button3" * Android:layout_width= "Wrap_content" $ Android:layout_height= "Wrap_content"Panax Notoginseng Android:text= "Btn3" /> - the <View + Android:layout_width= "Fill_parent" A Android:layout_height= "0.5DP" the Android:background= "#e5e5e5"/> + - </LinearLayout>
Operating effect:
The implementation method primarily places a imageview, view, or LinearLayout component and then sets it to the color of the divider line.
Similarly, we can use the view to set up separate parts, the code is as follows:
1 <LinearLayout2 android:orientation= "Horizontal"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Wrap_content">5 6 <TextView7 Android:layout_width= "Wrap_content"8 Android:layout_height= "60DP"9 Android:layout_marginleft= "15DP"Ten android:gravity= "Center" One Android:text= "Textview1" A Android:id= "@+id/"textview1 ""/> - - <View the Android:layout_width= "0DP" - Android:layout_weight= "1" - Android:layout_height= "Match_parent"/> - + - <TextView + Android:layout_width= "Wrap_content" A Android:layout_height= "60DP" at Android:layout_marginright= "15DP" - android:gravity= "Center" - Android:text= "Textview2" - Android:id= "@+id/textview2"/> - - </LinearLayout>
Effect:
15.Android linearlayout layout Some small records