Android--layout:relativelayout

Source: Internet
Author: User


Relative layout is the use of relative positional relationships between controls to set the layout.

A control in a container has a relative relationship to any other control or container.



For example:

<?xml version= "1.0" encoding= "Utf-8"? ><relativelayout xmlns:android= "http://schemas.android.com/apk/res/ Android "Android:layout_width=" Fill_parent "android:layout_height=" Fill_parent "> <textview android: Id= "@+id/textview2" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android:        layout_alignright= "@+id/textview1" android:layout_below= "@+id/textview1" android:layout_margintop= "14DP" Android:text= "Dear ~"/> <textview android:id= "@+id/textview1" android:layout_width= "wrap_content "Android:layout_height=" Wrap_content "android:layout_alignparenttop=" true "Android:layout_centerhori Zontal= "true" android:layout_margintop= "26DP" android:text= "Happy Mid-Autumn Festival"/> <analogclock android:id = "@+id/analogclock1" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android   : layout_below= "@+id/textview2"     Android:layout_centerhorizontal= "true" android:layout_margintop= "14DP"/></relativelayout> 

Layout Completion Effect:




The main way to use relative layout is to set the relative position of a control with the controls around him: for example, it is flush with the bottom of the * *, is flush with the top of a control, and is relative to the position in the parent control on the left or right side of a control.






Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android--layout:relativelayout

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.