您的位置:首页 > 移动开发 > Android开发

Android(四) Activity布局初步(一)

2015-12-15 13:19 661 查看
布局的初步介绍。包含布局的基础属性上的知识点

例如:id,text,textSize,background等等

包含如下布局介绍:

LinearLayout

TableLayout

布局xml的基础属性

xml命名空间

xmlns:android="http://schemas.android.com/apk/res/android"
<!-- 这是xml注释的格式-->


布局的基础属性

属性含义解释
android:id=”@+id/text”
android:layout_width=”fill_parent”宽度
android:layout_height=”wrap_content”高度
android:layout_weight=”1”权重决定和其他控件所占空间比例
android:text=”文本text”文本
android:textSize=”35pt”text大小pt 像素单位中的标准长度单位
android:background=”#aabbcc”RRGGBB 分别为三原色
android:gravity=”center_vertical”空间内容所处的位置居中等
android:padding=”30dip”内边距dip与像素无关、适应性好
android:singleLine=”true”内容是否在同一行为“false”可能会占据下面控件空间,“true”多余内容显示为…

布局

LinearLayout

TableLayout

属性 android:stretchColumns=”0”: 将第0列拉伸(与数组下标类似), 1:拉伸第1列(col)

<TableLayout
android:stretchColumns="0"
...>
<TableRow
...>
<TextView ... /> 控件11
<TextView ... /> 控件12
</TableRow>
<TableRow
...>
<TextView ... /> 控件21
<TextView ... /> 控件22
</TableRow>

</TableLayout>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐