Android編程布局(Layout)之AbsoluteLayout用法實(shí)例分析
本文實(shí)例講述了Android編程布局(Layout)之AbsoluteLayout用法。分享給大家供大家參考,具體如下:
AbsoluteLayout,顧名思義,就是絕對(duì)位置的布局;也可以叫做坐標(biāo)布局,也就是指定元素的絕對(duì)位置(或者叫絕對(duì)坐標(biāo)值)。這種布局簡(jiǎn)單直接,直觀性強(qiáng),但是由于手機(jī)屏幕尺寸差別比較大,使用絕對(duì)定位的適應(yīng)性會(huì)比較差。
<?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="wrap_content" android:padding="10dip"> <TextView android:id="@+id/lable" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="請(qǐng)輸入用戶名:"/> <EditText android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_x="100dip" android:layout_y="20dip"/> <Button android:id="@+id/cancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="10dip" android:layout_y="50dip" android:text="取消"/> <Button android:id="@+id/ok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="60dip" android:layout_y="50dip" android:text="確定"/> </AbsoluteLayout>
效果如下:

如果不指定Layout_x 和Layout_y 那么默認(rèn)都為0.回顯示在最左上角。
希望本文所述對(duì)大家Android程序設(shè)計(jì)有所幫助。
相關(guān)文章
全面解析Android系統(tǒng)指紋啟動(dòng)流程
這篇文章主要介紹了全面解析Android系統(tǒng)指紋啟動(dòng)流程,對(duì)Android啟動(dòng)原理感興趣的同學(xué)可以參考下2021-04-04
搭建mac使用Charles抓包安卓app環(huán)境配置過(guò)程
這篇文章主要為大家介紹了mac使用Charles抓包,安卓app環(huán)境搭建的配置過(guò)程步驟,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步2022-02-02
Android Studio實(shí)現(xiàn)簡(jiǎn)單計(jì)算器APP
這篇文章主要為大家詳細(xì)介紹了Android Studio實(shí)現(xiàn)簡(jiǎn)單計(jì)算器APP,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-03-03
Android Toolbar應(yīng)用欄使用方法簡(jiǎn)介
App中應(yīng)用欄是十分常見(jiàn)的,通常應(yīng)用欄會(huì)顯示當(dāng)前頁(yè)面的標(biāo)題,還有一些操作按鈕,例如返回、搜索、掃碼等。本文介紹如何通過(guò)Toolbar實(shí)現(xiàn)應(yīng)用欄2022-12-12
Android仿QQ未讀消息--紅點(diǎn)拖拽刪除【源代碼】
本文Demo是一款仿qq未讀消息拖拽刪除的例子,繼承RelativeLayout的WaterDrop實(shí)現(xiàn)了圓形圖標(biāo)功能;繼承ImageView的CircleImageView圓形圖片功能。效果非常不錯(cuò),很適合有圓形設(shè)計(jì)的朋友參考2017-04-04
Android 通過(guò)Messager與Service實(shí)現(xiàn)進(jìn)程間雙向通信案例詳解
這篇文章主要介紹了Android 通過(guò)Messager與Service實(shí)現(xiàn)進(jìn)程間雙向通信案例詳解,本篇文章通過(guò)簡(jiǎn)要的案例,講解了該項(xiàng)技術(shù)的了解與使用,以下就是詳細(xì)內(nèi)容,需要的朋友可以參考下2021-09-09

