欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

Android Layout之三:Linear Layout

系統 1911 0

?

Android Layout之三:Linear Layout

?

轉載自: http://android.blog.51cto.com/268543/298345

?

線形布局

?? ?? orientation - 容器內元素的排列方式。vertical: 子元素們垂直排列,horizontal: 子元素們水平排列。在代碼里可通過setOrientation()進行動態改變,值分別為HORIZONTAL或者VERTICAL。
?? ? * 在Linear Layout, ?寬度/高度都是按著組件的次序逐個占用的!所以當某個組件設置"fill_parent",在沒有設置Layout_weight的情況下,該組件會占用了余下的空間,那么在它后面的組件就會顯示不出來。如下圖的EditText如果沒有設置android:layout_weight="1", 它下面的其他組件就看不見了!
?
?? ? baselineAligned 一般情況下,這個屬性默認為true,代表在同一方向的組件都基于第一個組件對齊。所以可以看到下圖的text1, button1, text2是在同一水平線的。當不需要這效果時,可以設置為false。
main.xml配置內容:
        <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView         
	android:text="This is a example of linear layout."         
	android:layout_width="fill_parent"          
	android:layout_height="wrap_content"          
	/>     
<EditText         
	android:layout_width="fill_parent"         
	android:layout_height="fill_parent"         
	android:layout_weight="1"         
	android:id="@+id/edittext"         
	/>      
<LinearLayout         
	android:id="@+id/LinearLayout01"          
	android:layout_width="fill_parent"          
	android:layout_height="wrap_content"          
	android:orientation="horizontal"
	>         
	<TextView              
		android:text="text1"              
		android:id="@+id/TextView01"              
		android:layout_width="wrap_content"              
		android:layout_height="wrap_content"             
		/>         
	<Button 
		android:text="Button01"              
		android:id="@+id/Button01"              
		android:layout_width="fill_parent"              
		android:layout_height="wrap_content"             
		android:layout_weight="1"             
		/>         
	<TextView              
		android:text="text2"              
		android:id="@+id/TextView02"              
		android:layout_width="wrap_content"              
		android:layout_height="wrap_content"             
		/>     
</LinearLayout>      
<TextView         
	android:layout_width="wrap_content"         
	android:layout_height="wrap_content"         
	android:text="buttom"         
/> 
</LinearLayout>

      
?
結果如下圖:

Android Layout之三:Linear Layout
?

?

?

如果將main.xml配置內容中:

    <EditText         
	android:layout_width="fill_parent"         
	android:layout_height="fill_parent"         
	android:layout_weight="1"         
	android:id="@+id/edittext"         
	/> 
  

?

更改為:

?

    <EditText         
	android:layout_width="fill_parent"         
	android:layout_height="fill_parent"         
	android:layout_weight="0"         
	android:id="@+id/edittext"         
	/> 
  

?

或者:

    <EditText         
	android:layout_width="fill_parent"         
	android:layout_height="fill_parent"                 
	android:id="@+id/edittext"         
	/> 
  

?

那么,結果如下圖:

?


Android Layout之三:Linear Layout
?

?

發現組件edittext將下面的組件全部擋住了,這其中就數屬性 【 layout_weight 】導致的。

?

layout_weight - 重要度

?? ? 個人理解為顯示的優先級。默認為0(最高),數值越大,優先級越低!參考下面的Linear Layout例子。要讓layout_weight生效,需要父層或父父層的相應layout_width/layout_height = "fill_parent!

?

?

Android Layout之三:Linear Layout


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 成人午夜亚洲影视在线观看 | 日本一区二区三区高清不卡 | 国产欧美精品一区二区三区 | 日韩精品视频免费 | 欧美日韩一区在线 | 黄色福利| 午夜影院在线观看版 | 一级黄色绿像片 | 天天操一操 | 久在线| 日本欧美久久久久免费播放网 | 成人午夜在线视频 | 鲁久久 | 中文字幕 国产精品 | 亚洲97视频 | 天堂在线视频 | 天天骑天天干 | 色香婷婷 | 91久久精品一区二区二区 | 成年人xxxx| 欧美黑人玩白人巨大极品 | 欧美一级三级 | 狠狠综合久久av一区二区小说 | 欧美日韩福利视频 | 国产精品v欧美精品∨日韩 一级免费黄色免费片 | 精品九九九 | 国产精品a在线观看香蕉 | 国产亚洲精品久久一区二区三区 | 亚欧乱色一区二区三区 | 日本超碰 | 国产伦理一区二区三区 | 很黄很色的网站 | 亚洲欧美日韩国产精品26u | 性少妇videosexfreexx入片 | 国产日韩在线观看一区 | 亚洲精品一区二区三区不 | 中文字幕一区二区精品区 | 91视频 - 88av| 一级毛片ab片高清毛片 | 少妇的肉体的满足毛片 | 日韩精品一区二区三区免费观看 |