Android Layout LinearLayout

Source: Internet
Author: User

1.weight attribute Usage

Primarily for view object screen fit ratio

For example, the left side is proportional, the right side is 1:2 proportions

Implementation code:

<LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:id= "@+id/linearlayout1"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "Horizontal">               <LinearLayoutAndroid:layout_width= "0DP"Android:layout_height= "Fill_parent"Android:background= "#ADFF2F"Android:layout_weight= "1"/>                       <LinearLayoutAndroid:layout_width= "0DP"Android:layout_height= "Fill_parent"Android:background= "#DA70D6"Android:layout_weight= "2"/>            </LinearLayout>  

Usage: scale horizontally, set the ANDROID:WIDTH=0DP of the view, set the specific scale value of the Android weight property, and so on in the vertical direction.

2.divider attribute usage implement split line

Set up split lines between components, the interface display will be more clear and beautiful, such as

Implementation method:

(1) Adding a View object directly to the layout, displaying a line

< View       Android:layout_width = "Match_parent"       android:layout_height= "1px"      android:background= "#000000" />  

(2) using the Divider property to set the split line, you need to prepare the following

    • Android:divider setting a picture as a split line
    • Android:showdividers setting the position of a split line
    • dividerpadding setting the padding of a split line

Android Layout LinearLayout

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.