安卓(android)六大布局詳解

線性布局:(LinearLayout)

layout_width:fill_parent;match_parent;wrap_content
layout_height:
layout_weight:如果設(shè)置成wrap_content,權(quán)重越大得到越大
              如果設(shè)置成fill_parent,權(quán)重越大得到越小
orientation:horizontal,vertical(垂直)
gravity:子空間或者顯示內(nèi)容的布局方式
layout_gravity:自己控件在父組件對(duì)齊方式

margin(marginTop,marginBottom,marginLeft,marginRight):控件外邊界和其他控件外邊界邊距

相對(duì)布局:(RelativeLayout)

layout_above,layout_below,layout_toLeftOf,layout_toRightOf
layout_alignTop,layout_alignLeft,layout_alignRight,layout_alignBottom,layout_alignBaseLine
layout_alignParentTop,layout_alignParentLeft,layout_alignParentRight,layout_alignParentBottom,layout_alignWithParentIfMissing
layout_centerVertical,layout_centerHorizontal,layout_centerInParent

幀布局:(FrameLayout)
這種布局很少用到

表格布局:(TableLayout)

tableRow,
layout_columnSpan,
layout_rowSpan

絕對(duì)布局:(AbsoluteLayout)

layout_x
layout_y

網(wǎng)格布局:(GridLayout)

layout_columnCount,layout_rowCount(布局文件的屬性),oritation
子控件:默認(rèn)寬和高wrap_content;
layout_rowSpan,layout_columnSpan,必須設(shè)置屬性layout_gravity="fill"
layout_row,layout_column,,默認(rèn)不用指定
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容