Android Development Engineer Anthology-layout_weight explanation

Source: Internet
Author: User

Objective

Hello everyone, to bring you Android开发工程师文集-layout_weight讲解 an overview, I hope you like

Layout_weight related code Show
<TextView android:layout_width="0dp" android:layout_height="25dp" android:layout_weight="1" android:gravity="center" android:background="#000000"/><TextView android:layout_width="0dp" android:layout_height="25dp" android:layout_weight="2" android:gravity="center" android:background="#f0f0f0"/><TextView android:layout_width="0dp" android:layout_height="25dp" android:layout_weight="3" android:gravity="center" android:background="#a3a3a3"/>

Control occupies a 1:2:3 ratio

android:baselineAligned="false"

This property, which represents not based on the same horizontal plane.

Characteristics

The Layout_weight property in LinearLayout, which assigns the size of the control, and then assigns weight, if the control is set to text information, if the control is the width wrap_content , then the text information is first sorted and then weight assigned.

If the width is the match_parent case, the allocation is similar to the above, except that its proportional algorithm is not the same.

weightSumThis can be set to the scale of the entire parent control, android:weightSum="3" expressed as 3 allocations, then the following layout is divided into 3 points, can be 1:2,2:1 and so on.

Important: The total width minus the width of the setting is allocated.

If you feel good, then you can order a praise!??

Summarize
    • This article talks about the Android Development engineer anthology-layout_weight , if you have a better understanding, welcome to communicate
    • Positioning: Sharing Android & Java knowledge points, interested to continue to follow

Android Development Engineer Anthology-layout_weight explanation

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.