LinearLayout:線性佈局基礎

線性佈局是將放入其中的組件按照垂直或水平方向來佈局,也就是控制放入其中的組件橫向或縱向排列。

描述 屬性值 值說明





android:orientation 排列方式 vertical 垂直排列
horizontal 水平排列
android:gravity  對齊方式

屬性值可以同時指定,屬性值之間用|線隔開
top 頂部
bottom 底部
left 左邊
right 右邊
center_vertical 垂直居中
fill_vertical 垂直填充
center_horizontal 水平居中
fill_horizontal 水平填充
center 居中
fill 全局
clip_vertical 垂直剪輯
clip_horizontal 水平剪輯
android:layout_width 基本寬度 fill_parent
match_parent
wrap_content
android:layout_height 基本高度 fill_parent
match_parent
wrap_content
android:id 組件ID @+id/自定義名稱 通過findViewById()方法可獲取
android:background 背景 可以使用圖片或顏色

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章