Android学习 (九) 布局之TableLayout和 FrameLayout
来源:互联网 发布:淘宝男模特赚钱吗 编辑:程序博客网 时间:2024/05/22 04:25
1.TableLayout 布局
所有的控件都是以表格的形式添加进去的。
可以看到,就是在每一行里面添加控件,代码如下:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" //将 android:stretchColumns 的值指定为 1,表示如果表格不能完全占满屏幕宽度,就将第二列进行拉伸 //指定成 1 就是拉伸第二列,指定成 0 就是拉伸第一列,以此类推124 android:stretchColumns="1"> <TableRow> <TextView android:id="@+id/count" android:text="count" /> <EditText android:id="@+id/input_count" android:textColor="@color/red" android:hint="输入你的用户名" android:textColorHint="@color/huise" /> </TableRow> <TableRow> <TextView android:id="@+id/password" android:text="password" /> <EditText android:id="@+id/input_password" android:textColor="@color/red" android:textColorHint="@color/huise" android:hint="输入密码" /> </TableRow> <TableRow> /<Button android:id="@+id/button_1" android:text="登录" // android:layout_span="2" /> </TableRow></TableLayout>
有一个用于登录的按钮,前两行都有两列,第三行只有一列,这样的表格就会很难看,而且 结构也非常不合理。这时就需要通过对单元格进行合并来解决这个问题,使用 android:layout_span=”2”让登录按钮占据两列的空间,就可以保证表格结构的合理性了。
2.FrameLayout
在此框架下面定义的所有控件都是默认排在布局的左上角的,如果有几个控件,还会形成覆盖。比较简单,用处也不多。
<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/textView_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="it's my test" /> <ImageView android:id="@+id/imageView_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher"/></FrameLayout>
0 0
- Android学习 (九) 布局之TableLayout和 FrameLayout
- android布局##TableLayout和FrameLayout-android学习之旅(十五)
- 布局之TableLayout和FrameLayout
- Android 布局 之 TableLayout,RelativeLayout,AbsoluteLayout,FrameLayout
- Android之四大布局【LinearLayout,TableLayout,FrameLayout,RelativeLayout】
- 达内课程-布局控件之TableLayout和FrameLayout
- 浅谈Android五大布局(一)——LinearLayout、FrameLayout和AbsoulteLayout,RelativeLayout和TableLayout
- 浅谈Android五大布局(一)——LinearLayout、FrameLayout、AbsoulteLayout、RelativeLayout和TableLayout
- Android 五大布局(LinearLayout、FrameLayout、AbsoulteLayout、RelativeLayout、TableLayout )
- Android的布局管理器(上篇)-LinearLayout、TableLayout、FrameLayout、RelativeLayout
- 布局概述之帧布局FrameLayout和布局概述之表格布局TableLayout
- Android 布局(LinearLayout\TableLayout\RelativeLayout\AbsoluteLayout\FrameLayout)
- android AbsoluteLayou、FrameLayout 、TableLayout 布局介绍
- Android 布局(LinearLayout\TableLayout\RelativeLayout\AbsoluteLayout\FrameLayout)
- Android用户界面基础之LinearLayout、TableLayout、RelativeLayout、FrameLayout、GridLayout学习
- Android学习(十五)五布局之表格布局TableLayout
- Android布局之TableLayout(表格布局)
- android布局之表单布局(TableLayout)
- (动态规划)HDU1421搬寝室
- 单链表的逆置-C++实现
- Linux主机名的更改对oracle影响
- JZOJ4886. 字符串
- 大小写转化问题
- Android学习 (九) 布局之TableLayout和 FrameLayout
- 正则表达式中容易误解的地方
- java数据结构与算法 第4章 栈和队列
- 课后知识点回顾八 泛型
- 一种智能车控制算法的设计和实现
- 关于比赛的一些心得(别的大牛),谨在此转载
- struts2笔记_day02
- Git本地版本退回
- 1486. 统计数字