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 背景 可以使用图片或颜色

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