最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android入門之LinearLayout、AbsoluteLayout的用法實例講解

 更新時間:2014年08月08日 09:17:50   投稿:shichen2014  
這篇文章主要介紹了Android入門之LinearLayout、AbsoluteLayout的用法,對于Android初學者有很好的參考借鑒價值,需要的朋友可以參考下

本文實例介紹了Android中LinearLayout、AbsoluteLayout的用法,希望能對于初學Android的朋友起到一點幫助作用。具體內(nèi)容如下:

Android 的UI 布局都以Layout 作為容器,并且在上面按照規(guī)定排列控件,這方面跟JAVA 的Swing 和LWUIT 很像??丶鶯ayout 有很多屬性是一樣的,可以在Properties 里面修改,跟.NET/Delphi 等RAD 類似,其中最常用的屬性有以下這些:

id="@+id/edtInput",ID 是連接UI 與代碼的橋梁

Gravity= "center" ,Layout 中的控件居中

layout_width="fill_parent" ,自動填充至屏幕寬度,layout_height 同理

layout_width="wrap_content" ,自動填充為控件大小,layout_height 同理

LinearLayout ,在Android入門實例一篇所用的Layout 就是LinearLayout ,它的理解很簡單:在LinearLayout 里面的控件,按照水平或者垂直排列:
orientation="horizontal" :水平排列;orientation=" vertical" :垂直排列
當LinearLayout 是horizontal ,并且里面的控件使用了layout_width="fill_parent" ,第二組控件會擋在屏幕的右邊,那也就是看不到了。

AbsoluteLayout ,是一個按照絕對坐標定義的布局,由于使用絕對坐標去定位控件,因此要實現(xiàn)自適應界面時,應盡少使用 AbsoluteLayout 。 AbsoluteLayout 里面的控件都以layout_x 、layout_y 來定義其位置:

 

上圖中的TextView01的X坐標為10px,Y坐標為10px,頁面布局代碼如下:

<AbsoluteLayout android:id="@+id/AbsoluteLayout01" android:layout_height="wrap_content" android:layout_width="fill_parent" > 
<TextView android:text="TextView01" android:id="@+id/TextView01" android:layout_height="wrap_content" android:layout_y="10px" android:layout_width="wrap_content" android:layout_x="110px"> 
</TextView> 
</AbsoluteLayout>

相關文章

最新評論

霍山县| 伊吾县| 资溪县| 普洱| 运城市| 杂多县| 长丰县| 开化县| 平乡县| 东方市| 金湖县| 郑州市| 牙克石市| 舒兰市| 汕尾市| 察雅县| 泰来县| 五华县| 开远市| 秦安县| 崇仁县| 会昌县| 来宾市| 改则县| 博白县| 抚松县| 连江县| 上虞市| 汕头市| 秭归县| 保山市| 祁阳县| 万州区| 吉首市| 汪清县| 富锦市| 乌拉特中旗| 海南省| 新郑市| 东方市| 孝义市|