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 ...
随机推荐
- nginx中使用srcache_nginx模块构建缓存
nginx中可以将lua嵌,让nginx执行lua脚本,可以处理高并发,非阻塞的处理各种请求,openresty项目中可以使用nignx可以直接构建 srcache_nginx + redis 缓存, ...
- 07_旅行商问题(TSP问题,货郎担问题,经典NPC难题)
问题来源:刘汝佳<算法竞赛入门经典--训练指南> P61 问题9: 问题描述:有n(n<=15)个城市,两两之间均有道路直接相连,给出每两个城市i和j之间的道路长度L[i][j],求 ...
- Spring @Transactional ——事务回滚
工作原理运行配置@Transactional注解的测试类的时候,具体会发生如下步骤1)事务开始时,通过AOP机制,生成一个代理connection对象,并将其放入DataSource实例的某个与Dat ...
- Add Binary
Add Binary https://leetcode.com/problems/add-binary/ Given two binary strings, return their sum (als ...
- D_S 线性表的顺序表示和实现
线性表的顺序表示又称为顺序存储结构或顺序映像 顺序存储定义:把逻辑上相邻的数据元素存储在物理上相邻的存储单元中的存储结构,简言之,逻辑上相邻,物理上也相邻 顺序存储方法:用一组地址连续的存储单元依次存 ...
- Vbox 安装 OS X 10.11
http://bbs.pcbeta.com/viewthread-1635810-1-1.html http://ibiji.org/post/26.html 破解 Vbox 下OS 限制登录 V ...
- Window I/O 完成端口 (Windows I/O Completion Port (IOCP))
相关对象 IO EndPoint, 所有支持重叠IO(overlapped IO)的设备,比如文件,Winsock,管道等. IOCP, IO完成端口内核对象,可以使用API CreateIoComp ...
- CUDA入门1
1GPUs can handle thousands of concurrent threads. 2The pieces of code running on the gpu are calle ...
- MIT jos 6.828 Fall 2014 训练记录(lab 2)
注: 源代码参见我的github:https://github.com/YaoZengzeng/jos Part1 : Physical Page Management mem_init函数: /*该 ...
- 深度优先搜索 codevs 1065 01字符串
codevs 1065 01字符串 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题目描述 Description 输出仅有0和1组成的长度为n的字符串,并且 ...