Layout_gravity,gravity,wrap_content,match_parent

Source: Internet
Author: User

Android:gravity:

This is for the elements in the control, to control where the element is displayed in the control. For example, set the following two properties in a button control

Android:gravity= "left" and android:text= "submit", then the text "Submit" on the button will be on the right side of the button.

Android:layout_gravity:

This is for the control itself , which controls the position of the control in the parent control that contains the control. Similarly, when we set the android:layout_gravity= "left" property in the button control, it means that the button will be located at the right-hand side of the interface.


Wrap_content

    Set the size of a view to wrap_content will force the view to expand to show the whole content. With textview imageview Control as an example, set to wrap_content The text and images inside of it will be fully displayed. Layout elements will change size based on content. Set the size of a view to wrap_content Roughly equivalent to setting windows control Span style= "Font-family:times New Roman" >autosize true


Match_parent

The component is forced to be expanded to fill as much space as possible within the layout unit.

 android2.2 match_parent and fill_parent is a meaning   two parameter meaning, more apt, so from start two words can be used. So if you consider the use of the lower version you will need to use the


Layout_gravity,gravity,wrap_content,match_parent

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.