本文實例為大家分享了Android絕對布局AbsoluteLayout的具體代碼,供大家參考,具體內容如下
1>AbsoluteLayout(絕對布局)
又可以叫做坐標布局,可以直接指定子元素的絕對位置(xy)
2>由于手機屏幕尺寸差別比較大
使用絕對定位的適應性會比較差,在屏幕的適配上有缺陷
3>AbsoluteLayout子類控件的屬性
android:layout_x=”35dip” 控制當前子類控件的x位置
android:layout_y=”40dip” 控制當前子類控件的y位置
開發中不推薦使用
<?xml version="1.0" encoding="utf-8"?><AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="236dp" android:layout_y="94dp" android:text="Button" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="143dp" android:layout_y="166dp" android:text="Button" /> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="33dp" android:layout_y="263dp" android:text="Button" /></AbsoluteLayout>

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。
新聞熱點
疑難解答