Android五大布局標籤和屬性總結

來源:互聯網
上載者:User

標籤:android   布局   relativelayout   textview   layout   

1.LinearLayout


orention  水平和垂直
weight     分割閑置空間
水平布局 分割寬度
垂直布局 分割的高度






分割的時候 指定的高度或者寬度不能用fill_parent/match_parent




2.Tablayout
<TabRow> </TabRow> 一行
<TabRow> </TabRow>
缺陷  第一行的列級關係 會影響下面所有的列
3.RelativeLayout
view間的關係
CenterInParent  true
alignparentxxxx true  有沒有貼到父親的位置
centerVertical  垂直劇中
centerHorzital  水平劇中


--------------------------------
aboveof    @view  再誰的上面
belowof    @view 在誰的下面
toleftof   @viw 在誰的左邊
torightof @view 在誰的右邊
alignxxxx @view 和誰在xxxx的邊界上齊平








作業:
1.布局 (LinearLayout  Tablayout  RelativewLayout)
1.手抄3遍 新學屬性 解釋




TextView 文字組件
text 顯示的文字
textSize 文字大小
textColor 文字顏色
background 背景顏色


EditText 文本輸入框
hint 提示文字






LinearLayout 線性布局
TableLayout 表格布局
RelativeLayout 相對布局


layout_width view寬度的方式
layout_height view高度的方式
match_parent 匹配父組件
wrap_content 包含內容







layout_weight 權重


orientation 布局方向
horizontal 水平
vertical 垂直


layout_margin 四周外邊距
layout_marginTop 上邊外邊距
layout_marginBottom 下邊外邊距
layout_marginLeft 左邊外邊距
layout_marginRight 右邊外邊距






layout_padding 四周內邊距
paddingTop 上邊內邊距
paddingBottom 下邊內邊距
paddingLeft 左邊內邊距
paddingRight 右邊內邊距






layout_above 在哪個view之上
layout_below 在哪個view之下
layout_toLeftOf 在哪個view之左
layout_toRightOf 在哪個view之右


layout_alignTop 和某個view的上邊對齊
layout_alignBottom 和某個view的下邊對齊
layout_alignLeft 和某個view的左邊對齊
layout_alignRight 和某個view的右邊對齊


layout_alignParentTop 是否緊貼父組件上邊
layout_alignParentBottom 是否緊貼父組件下邊
layout_alignParentLeft 是否緊貼父組件左邊
layout_alignParentRight 是否緊貼父組件右邊


layout_centerInParent 是否在父組件的中心
layout_centerHorizontal 是否水平置中
layout_centerVertical 是否垂直置中






TableRow 表格布局裡面的一行
gravity 內容置中

Android五大布局標籤和屬性總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.