(Android Studio) add buttons and weight issues

Source: Internet
Author: User

Most of this article was excerpted from http://hukai.me/android-training-course-in-chinese/basics/firstapp/building-ui.html

Notice that the line of code where the cursor is located is commented out. The effect appears as shown on the right.

Uncomment, android:layout_weight= "1" function, the effect as shown on the right: compared to the previous picture, the text box occupies the blank space behind this line button, the button is "squeezed" to the far right.

Note: in order to improve the efficiency of the layout, when setting weights, the width of the edittext should be set to 0DP. If you set "Wrap_content" as the width, the system needs to calculate the width of the part itself, and because the weight is set, the system automatically takes up the remaining space, and the width of the edittext finally becomes a non-functional property.

(Android Studio) add buttons and weight issues

Related Article

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.