Getting Started with Android (v) Screen components 5.3 absolutelayout Absolute Layout

Source: Internet
Author: User

Using Absolutelayout, you can specify the exact location of the child view in it. Observe the code in the following main.xml:

<?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=" fill_parent ">    
       
    < Button 
        android:layout_width= "188DP" 
        android:layout_height= "wrap_content" 
        android:layout_x= "126px" 
        android:layout_y= "361px" 
        android:text= "button"/>    
       
    <button 
        android:layout_width= "113DP" 
        android:layout_height= "wrap_content" 
        android:layout_x= "12px" 
        android:layout_y= "361px" 
        android:text= "button"/>    
       
</AbsoluteLayout>

Here is the effect chart, using the Android:layout_x and Android_y properties, and placing the two button in the exact position.

But when the activity is plotted on a high-resolution screen, there are some problems with the absolutelayout.

The following figure shows the effect on a high-resolution screen with the same code.

For this reason, Google officially has not recommended this layout since Android1.5, although it is now available. When creating the UI, you should avoid using the Absolutelayout layout, because Android does not ensure that it will continue to be supported in future releases.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

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.