【Android基础】页面布局
来源:互联网 发布:mac设置文件夹加密 编辑:程序博客网 时间:2024/06/06 02:13
线性布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <!-- 垂直的线性布局 --> <Button android:id="@+id/next" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/line_str1"> </Button> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> <!-- 水平的线性布局 --> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/line_str2"> </Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/line_str3"> </Button> </LinearLayout></LinearLayout>
表格布局
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- 表格布局 --> <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/table_str1"> </TextView> <!-- 表头 --> <TableRow android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/table_str2"> </TextView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/table_str3"> </TextView> </TableRow> <!-- 添加一行 --></TableLayout>
相对布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:padding="@dimen/padding_medium" android:text="@string/hello_world" tools:context=".RelativeActivity" /> <Button android:id="@+id/back1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/relative_str1" android:layout_above="@id/textView" android:layout_alignLeft="@id/textView"> </Button> <Button android:id="@+id/next2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/relative_str2" android:layout_below="@id/textView" android:layout_alignRight="@id/textView"> </Button></RelativeLayout>
单帧布局
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:contentDescription="@string/hello_world"/> <Button android:id="@+id/next3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/relative_str2"> </Button></FrameLayout>
坐标布局
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="30dp" android:layout_y="50dp" android:padding="@dimen/padding_medium" android:text="@string/hello_world" tools:context=".AbsoluteActivity" /></AbsoluteLayout>
- 【Android基础】页面布局
- android基础学习——页面布局
- Android基础_页面布局_RelativeLayout(相对布局)
- Android基础_页面布局_LinearLayout(线性布局)
- Android基础_页面布局_TableLayout(表格布局)
- CSS页面布局基础
- 页面布局基础1
- 页面布局基础2
- 页面布局基础3
- css页面布局基础
- css页面布局基础
- css页面布局基础
- css页面布局基础
- 页面布局基础
- HTML页面布局基础
- CSS页面布局基础
- 【android基础学习之八】——页面布局
- Android基础_页面布局_碎片(Fragment)
- 网站策划师成长之路——网站策划与设计实战
- 超链接在office中不起作用
- PHP获取当前类名、方法名
- 二叉查找树的实现
- Life 十年经验 给程序员的一些总结性忠告
- 【Android基础】页面布局
- 避免常见的内存错误应注意的五点
- 谁是下一百个亿万富翁——移动互联网时代的造富机会
- Archive app, 打包成.ipa格式的app包
- 求最近点对算法分析
- 找回Windows7右下角输入法图标
- iOS7 SDK新特性
- c# io 读取本地文件
- [Oracle]-[recyclebin][索引]-回收站恢复的索引名称修改