15.Android linearlayout layout Some small records

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.