Android四大布局及其主要属性
2015-12-02 09:50
423 查看
布局:
<LinearLayout></LinearLayout>
<RelativeLayout></RelativeLayout>
<FrameLayout></FrameLayout>
<TableLayout></TableLayout>
四种布局的公共属性: android:id="@+id/id_name" android:layout_width="wrap_content" ="match_parent" android:layout_height="wrap_content" ="match_parent" android:text="message" ||显示文字 android:src="@drawable/ic_launcher" ||显示图片 android:hint="tips" ||提示文字 android:inputType="textPassword" ||按照密文的方式输入,隐藏输入内容 ... <LinearLayout></LinearLayout> 属性: android:orientation="vertical" ||垂直 ="horizontal" ||水平 android:layout_gravity="top" ="bottom" ="center" ="center_vertical" ="center_horizontal" ... android:layout_weight="1" ||权重 <RelativeLayout></RelativeLayout> 属性: android:layout_alignParentLeft="true" ||对齐于父类的左侧 ="false" android:layout_alignParentRight="true" ||对齐于父类的右侧 ="false" android:layout_alignParentTop="true" ||对齐于父类的上侧 ="false" android:layout_alignParentBottom="true" ||对齐于父类的底侧 ="false" android:layout_centerInParent="true" ||对齐于父类的中心 ="false" android:layout_above="@id/id_name" ||在某一控件的上方(注意要先定义被引用的控件) android:layout_below="@id/id_name" ||在某一控件的下方 android:layout_toLeftOf="@id/id_name" ||在某一控件的左方 android:layout_toRightOf="@id/id_name" ||在某一控件的右方 android:layout_alignLeft="@id/id_name" ||本控件的左边缘和某一控件的左边缘对齐 android:layout_alignRight="@id/id_name ||本控件的右边缘和某一控件的右边缘对齐 android:layout_alignTop="@id/id_name" ||本控件的上边缘和某一控件的上边缘对齐 android:layout_alignBottom="@id/id_name" ||本控件的下边缘和某一控件的下边缘对齐 <FrameLayout></FrameLayout> 属性: 全部控件均摆放在布局的左上角(碎片) <TableLayout></TableLayout> 属性: <TableRow></TableRow> 在表格中添加一行,TableRow中添加一个控件则增加一列 属性: android:layout_span="2" ||占据2列的空间 android:stretchColumns="1" ||拉伸第2列使的行充满父类 android:stretchColumns="0" ||拉伸第1列使的行充满父类
相关文章推荐
- Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class lzl.edu.c
- Android编程实现监控各个程序流量的方法
- android sdk 国内镜像
- 分享方法:android 获得屏幕状态
- android 子菜单
- Android调用系统相机、自定义相机、处理大图片
- android 弹出菜单
- android TableLayout
- Android扫描枪(PDA)开发
- android源码加入第三方apk,带so的mk文件写法,兼容64位平台
- android 圆形按钮
- Android开发屏幕适配全攻略
- Android样式的开发:drawable汇总篇
- Android界面设计视觉规范
- android拍照与读取相册
- Android下GPRS定位
- Android 代码中杀死进程
- android DatePicker使用
- Android 学习笔记---获取RadioGroup的选定值
- Android哈哈镜实现源码