android 类型
2016-05-20 21:19
519 查看
1.GridLayout布局
此布局是实现网格布局
rowCount="num"----num是具体数值,是网格的行数
columnCount="num"---同上,实现网格的列数
1>layout_columnSpan="num"同上,实现网格列的合并
layout_rowCount="num"同上,实现网格行的合并
合并时要用到layout_gravity="fill"
2.FrameLayout 单帧布局
单帧布局结构简单,所有子元素部分覆盖或全部覆盖前面的元素,而且都位于左上角
3.AbsoluteLayout 绝对位置布局
以屏幕上的左上角为原点(0,0),横的为X,纵的为Y,都为正值。子元素可以相互重叠,适配性不好,较少使用
此布局是实现网格布局
rowCount="num"----num是具体数值,是网格的行数
columnCount="num"---同上,实现网格的列数
1>layout_columnSpan="num"同上,实现网格列的合并
layout_rowCount="num"同上,实现网格行的合并
合并时要用到layout_gravity="fill"
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:rowCount="7" android:columnCount="4"> <TextView android:layout_columnSpan="4" android:text="0" android:textSize="@dimen/font32" android:layout_row="1" android:layout_column="0" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="time" android:ems="10" android:id="@+id/editText3" android:layout_row="0" android:layout_column="2" /> <Button android:text="1" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_row="2" android:layout_column="0" /> <Button android:text="2" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="2" android:layout_column="1" /> <Button android:text="3" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="2" android:layout_column="2" /> <Button android:text="+" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="2" android:layout_column="3" /> <Button android:text="4" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="3" android:layout_column="0" /> <Button android:text="5" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="3" android:layout_column="1" /> <Button android:text="6" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="3" android:layout_column="2" /> <Button android:text="-" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="3" android:layout_column="3" /> <Button android:text="=" android:textSize="20sp" android:layout_margin="5dp" android:layout_rowSpan="2" android:layout_gravity="fill" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="4" android:layout_column="0" /> <Button android:text="7" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="4" android:layout_column="1" /> <Button android:text="8" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="4" android:layout_column="2" /> <Button android:text="*" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="4" android:layout_column="3" /> <Button android:text="9" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="5" android:layout_column="1" /> <Button android:text="0" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="5" android:layout_column="2" /> <Button android:text="\" android:textSize="20sp" android:layout_margin="5dp" android:background="@color/colorAccent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_row="5" android:layout_column="3" /> </GridLayout>
2.FrameLayout 单帧布局
单帧布局结构简单,所有子元素部分覆盖或全部覆盖前面的元素,而且都位于左上角
3.AbsoluteLayout 绝对位置布局
以屏幕上的左上角为原点(0,0),横的为X,纵的为Y,都为正值。子元素可以相互重叠,适配性不好,较少使用
相关文章推荐
- 谈谈Android系统启动时的那点事儿
- Android之解决Android Studio 出现ADB not responding.... kill "adb.exe" and click 'Restart'
- Android消息处理机制(Handler 与Message)---01
- Android中的小组件(widget)的写法
- Android录音播放、停止
- Android学习记录(十六) recyclerview 滑动慢的问题。
- Android一键锁屏组件小应用
- TabHosts导航按钮实现自定义图片和文字
- android:layout_gravity和android:gravity的区别
- LayoutInflater的错误用法(Avoid passing null as the view root )
- EventBus的使用
- Android View类中的生命周期是怎样的
- Android开发发布lib到jcenter
- 按两次返回键退出程序
- Android之ListView自带的布局simple_list_item
- Android 迷之Version管理
- Xposed源码阅读小结
- Android之ListView内容数据刷新
- Android判断当前线程是否是主线程的方法
- Android DiskLruCache完全解析,硬盘缓存的最佳方案