Android四大布局及其主要属性
布局:
<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列使的行充满父类
Android四大布局及其主要属性的更多相关文章
- Android 四大布局属性介绍
线性布局 控件距离布局底,左,右,顶部部的距离 android:paddingBottom="35.0dip" android:paddingLeft=" ...
- Android四大组件之Activity(活动)及其布局的创建与加载布局
Android四大组件之Activity(活动)及其布局的创建与加载布局 什么是Activity ? 活动(Activity)是包含用户界面的组件,主要用于和用户进行交互的,一个应用程序中可以包含零个 ...
- Android组件---四大布局的属性详解
[声明] 欢迎转载,但请保留文章原始出处→_→ 文章来源:http://www.cnblogs.com/smyhvae/p/4372222.html Android常见布局有下面几种: LinearL ...
- Android——四大组件、六大布局、五大存储
一.android四大组件 (一)android四大组件详解 Android四大组件分别为activity.service.content provider.broadcast receiver. 1 ...
- android四大组件之Broadcast
广播的概念 现实中:我们常常使用电台通过发送广播发布消息,买个收音机,就能收听 Android:系统在产生某个事件时发送广播,应用程序使用广播接收者接收这个广播,就知道系统产生了什么事件.Androi ...
- Android四大基本组件介绍与生命周期
Android四大基本组件介绍与生命周期 Android四大基本组件分别是Activity,Service服务,Content Provider内容提供者,BroadcastReceiver广播接收器 ...
- Android成长日记-Android四大组件之Service组件的学习
1.什么是Service? Service是Android四大组件中与Activity最相似的组件,它们都代表可执行的程序,Service与Activity的区别在于:Service一直在后台运行,它 ...
- Android四大组件之——Activity的生命周期(图文详解)
转载请在文章开头处注明本博客网址:http://www.cnblogs.com/JohnTsai 联系方式:JohnTsai.Work@gmail.com [Andro ...
- Android 五大布局
Android 五大布局: FrameLayout(框架布局),LinearLayout (线性布局),AbsoluteLayout(绝对布局),RelativeLayout(相对布局),Table ...
随机推荐
- java微信接口之五—消息分组群发
一.微信消息分组群发接口简介 1.请求:该请求是使用post提交地址为: https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_t ...
- oracle树操作(select start with connect by prior)
oracle中的递归查询可以使用:select .. start with .. connect by .. prior 下面将会讲述oracle中树形查询的常用方式,只涉及到一张表. 一. 建表语句 ...
- ssis trainning
1. 防止包打开后hang住,可以使用delay validation=false. 2.2008R2 configuration 起作用的优先级? 一是des ign time. 二是运行的时候指定 ...
- nopcommerce商城系统--如何编写一个插件
原址:http://www.nopcommerce.com/docs/77/how-to-write-a-nopcommerce-plugin.aspx plug-in (或 plugin)是一个为更 ...
- Tomcat 长连接与短连接性能测试
环境: 操作系统:centos 6.5 x64 cpu:32 core 内存: 32G web服务器:tomcat 6.x jdk :1.6x 测试环境: 操作系统:centos 6.5 x64 c ...
- Linux上Eclipse项目右键菜单没有Maven
在Centos 7上安装了eclipse以后,着实很兴奋.eclipse luna版本自带maven.但是用mvn eclipse:eclipse创建的java工程,在右键菜单居然没有Maven按钮, ...
- MIT jos 6.828 Fall 2014 训练记录(lab 2)
注: 源代码参见我的github:https://github.com/YaoZengzeng/jos Part1 : Physical Page Management mem_init函数: /*该 ...
- CSS强制性换行word-break与word-wrap的使用
一般情况下,元素拥有默认的white-space:normal(自动换行,不换行是white-space:nowrap),当录入的文字超过定义的宽度后会自动换行,但当录入的数据是一堆没有空格的字符或字 ...
- spring,hibernate,struts的面试笔试题
1 Action是不是线程安全的?如果不是 有什么方式可以保证Action的线程安全?如果是,说明原因不是声明局部变量,或者扩展RequestProcessor,让每次都创建一个Action,或者在s ...
- 深入.NET框架 项目《魔兽登录系统》
创建魔兽系统相关窗体: 登录窗体(frmLogin) 注册窗体(frmRegister) 主窗体 (frmMain) 实现魔兽登录系统: 登录的界面如下 实现思路: 1.创建一个对象数组,长度为1 ...