LinearLayout 线性布局 ---分水平和垂直
TableLayout
FrameLayout 单帧布局 --- 控件会重叠
dip: device independent pixels 设备独立像素
tablelayout例子:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1" > 从0开始数,对某column实施自动施展
<TableRow>
<TextView
android:text="@string/hello"
android:background="#aa0000"
android:padding="3dip"
/>
<TextView
android:text="@string/hello"
android:background="#006600"
android:gravity="center_horizontal" 字体居中
android:padding="3dip"
/>
<TextView
android:text="@string/hello"
android:background="#0000aa"
android:padding="3dip"
/>
</TableRow>
</TableLayout>
显示效果

===========================================
关于RelativeLayout:
TableLayout
FrameLayout 单帧布局 --- 控件会重叠
dip: device independent pixels 设备独立像素
tablelayout例子:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1" > 从0开始数,对某column实施自动施展
<TableRow>
<TextView
android:text="@string/hello"
android:background="#aa0000"
android:padding="3dip"
/>
<TextView
android:text="@string/hello"
android:background="#006600"
android:gravity="center_horizontal" 字体居中
android:padding="3dip"
/>
<TextView
android:text="@string/hello"
android:background="#0000aa"
android:padding="3dip"
/>
</TableRow>
</TableLayout>
显示效果

===========================================
关于RelativeLayout:

本文详细介绍TableLayout在Android应用中的使用方法,包括如何设置表格布局的宽度、高度以及如何实现自动扩展某一列的功能。同时,提供了具体的XML代码示例,演示了如何通过TableLayout组织TextView控件,并设置背景颜色及文本居中等属性。
1080

被折叠的 条评论
为什么被折叠?



