绝对布局AbsoluteLayout
AbsoluteLayout基本上都是不会使用,因为我们开发的应用需要在很多的机型上面进行适配,如果使用了这个绝对布局,可能你在4寸的手机上是显示正常的,而换成5寸的手机,就可能出现偏移和变形,所以这个布局不建议使用。AbsoluteLayout是直接通过X,Y坐标来控制组件在Activity中的位置的,Android中把屏幕的左上角坐标设定为(0,0),水平向左为宽度,垂直向下为高度。
1.基本语法格式
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
属性列表
>
</AbsoluteLayout >
2.实例
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="32dp"
android:layout_y="53dp"
android:text="Button1" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="146dp"
android:layout_y="53dp"
android:text="Button2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="85dp"
android:layout_y="135dp"
android:text="Button3" />
</AbsoluteLayout>
效果:::