An example of absolutelayout usage of Android programming layout (Layout) _android

Source: Internet
Author: User

This example describes the Absolutelayout usage of the Android programming layout (Layout). Share to everyone for your reference, specific as follows:

Absolutelayout, as the name suggests, is the absolute position of the layout, can also be called the coordinate layout, that is, the absolute position of the specified element (or the absolute value of the coordinates). This layout is simple and direct, intuitive, but because the screen size of the mobile phone is relatively large, the use of absolute positioning is relatively poor adaptability.

 <?xml Version = "1.0" encoding = "Utf-8"?> <absolutelayout xmlns:android= "http://"
 Schemas.android.com/apk/res/android "android:layout_width=" fill_parent "android:layout_height=" Wrap_content " android:padding= "10dip" > <textview android:id= "@+id/lable" android:layout_width= "Fill_parent" android:layout _height= "wrap_content" android:text= "Please enter the username:"/> <edittext android:id= "@+id/text" android:layout_width= "Fill_ Parent "android:layout_height=" wrap_content "android:layout_x=" 100dip "android:layout_y=" 20dip "/> <button Android:id= "@+id/cancel" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android:layout_ x= "10dip" android:layout_y= "50dip" android:text= "Cancel"/> <button android:id= "@+id/ok" android:layout_width= " Wrap_content "android:layout_height=" wrap_content "android:layout_x=" 60dip "android:layout_y=" 50dip "android:t ext= "OK"/> </absolutelayout> 

The effect is as follows:

If you do not specify layout_x and layout_y, the default is 0. The back is displayed in the upper-left corner.

I hope this article will help you with the Android program.

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.