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/