Android-how to understand the width and height of controls and the difference between layout_grivaty and grivaty, androidlayout

Source: Internet
Author: User

Android-how to understand the width and height of controls and the difference between layout_grivaty and grivaty, androidlayout
Thoughts on width and height caused by Layout_width/height

Method 1:




The result is not as expected.

Running result:



Method 2:



The results are as expected.

For example:



Android control width and height rules:

By default, the widget in Android does not have width or height, but is given by the parent widget.

The general view control is provided to the ViewGroup control (LinearLayout, RelativeLayout, TableLayout, FrameLayout, and AbsoluteLayou.

The width and height of layout controls such as LinearLayout and RelativeLayout are set by the FrameLayout control of the Android system. You can use hierarchyviewer. bat, a tool under android-sdk/tools, to view details, such:


Solution for method 1 Modification, The following code:



The running result is as follows:



Layout_grivaty and grivaty


Note the following when using layout_grivaty:


The result is as follows:




The result is as follows:



Differences:




Zookeeper

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.