Android布局之絕對布局AbsoluteLayout詳解
本文實例為大家分享了Android絕對布局AbsoluteLayout的具體代碼,供大家參考,具體內(nèi)容如下
1>AbsoluteLayout(絕對布局)
又可以叫做坐標布局,可以直接指定子元素的絕對位置(xy)
2>由于手機屏幕尺寸差別比較大
使用絕對定位的適應性會比較差,在屏幕的適配上有缺陷
3>AbsoluteLayout子類控件的屬性
android:layout_x=”35dip” 控制當前子類控件的x位置
android:layout_y=”40dip” 控制當前子類控件的y位置
開發(fā)中不推薦使用
<?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>
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
Android使用popupWindow仿微信彈出框使用方法
這篇文章主要為大家詳細介紹了Android使用popupWindow仿微信彈出框使用方法,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-09-09Android基于Fresco實現(xiàn)圓角和圓形圖片
這篇文章主要為大家詳細介紹了Android基于Fresco實現(xiàn)圓角和圓形圖片,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-04-04Android studio2.3.3升級到3.1.2坑(小記)
這篇文章主要介紹了Android studio2.3.3升級3.1.2坑(小記),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-09-09Android編程實現(xiàn)對話框Dialog背景透明功能示例
這篇文章主要介紹了Android編程實現(xiàn)對話框Dialog背景透明功能,涉及Android對話框的布局、屬性及事件處理相關操作技巧,需要的朋友可以參考下2017-07-07Android中修改TabLayout底部導航條Indicator長短的方法
Tablayout在我們?nèi)粘i_發(fā)中經(jīng)常會遇到,下面這篇文章主要給大家介紹了在Android中修改TabLayout底部導航條Indicator長短的方法,文中給出了詳細的示例代碼供大家參考學習,需要的朋友們下面來一起看看吧。2017-06-06