Android学习笔记6——基本布局
【目录】
1.linearLayout
2.tableLayout
3.Layout 可以互相嵌套
4.RelativeLayout(灵活性好些,不少对齐参数)
1.linearLayout
linearlayout常用的TextView属性
<textarea cols="50" rows="15" name="code" class="java:collapse"> android:id="@+id/myTextView" android:padding="10dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:background="#00aa00" android:layout_weight="1"</textarea>
图1 整体效果图
PS:
没时间写完整了,大家记得看那位高手的第9集,[Android开发视频教学].01_09_Activity布局初步(一)
电驴上面有得下,关键是比优酷的清晰多了
2.tableLayout
3.Layout 可以互相嵌套
图2 Table 嵌到 linear里
<textarea cols="50" rows="15" name="code" class="java:collapse"> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TableRow> <TextView android:text="计算2" android:textSize="20pt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:background="#aa0000" /> <TextView android:text="计算3" android:textSize="20pt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:background="#0000aa" /> </TableRow> </TableLayout></textarea>
Table里的要加入TableRow
更多相关文章
- AndroidTextView的跑马灯效果,解决复杂布局不能获取焦点的问题
- android ListView嵌套checkbox并取代checkbox点击事件
- Android:控件布局(相对布局)RelativeLayout(转)
- Android中的5大布局和网格布局
- Android 让一个控件或布局居于底部的办法
- Android再学习-20141018-布局-进度条