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 ...
随机推荐
- Effective Java 59 Avoid unnecessary use of checked exceptions
The burden is justified if the exceptional condition cannot be prevented by proper use of the API an ...
- 【linux】spinlock 的实现
一.什么是spinlock spinlock又称自旋锁,是实现保护共享资源而提出一种锁机制.自旋锁与互斥锁比较类似,都是为了解决对某项资源的互斥使用 无论是互斥锁,还是自旋锁,在任何时刻,最多只能有一 ...
- Swing应用开发实战系列之二:设计日期选择面板窗口
Swing本身没有提供什么华丽丽的日期时间选择控件,所以笔者就在网上搜了个第三方的jar包jdatepicker-1.3.2.jar,基于此设计了个很轻量的日期选择面板,很简单的.效果图如下所示: 代 ...
- Github学习进阶-初露锋芒,通过命令行将本地git仓库推送到Github上面的仓库
前提: 1. 需要安装git 客户端. 能打开 git bash 命令行窗口. 2. 生成了ssh 秘钥,并添加到了Github上面. 一.在Github上面建立一个git仓库. 点击 + 号,在 ...
- [转]SQLServer 2008数据库查看死锁、堵塞的SQL语句
本文转自:http://www.cnblogs.com/zhuque/archive/2012/11/08/2763343.html 死锁和堵塞一直是性能测试执行中关注的重点. 下面是我整理的监控sq ...
- [转]Ionic最佳实践-使用模态窗口modal
本文转自:http://m.blog.csdn.net/blog/betreex/45649689 原文地址:Ionic最佳实践-使用模态窗口modal 模态窗口的结构 在Ionic中,模态窗口通过$ ...
- hihocoder 1388 &&2016 ACM/ICPC Asia Regional Beijing Online Periodic Signal
#1388 : Periodic Signal 时间限制:5000ms 单点时限:5000ms 内存限制:256MB 描述 Profess X is an expert in signal proce ...
- UVA 562 Dividing coins --01背包的变形
01背包的变形. 先算出硬币面值的总和,然后此题变成求背包容量为V=sum/2时,能装的最多的硬币,然后将剩余的面值和它相减取一个绝对值就是最小的差值. 代码: #include <iostre ...
- DoTween(HOTween V2) 教程
DoTween资料 官方网站:http://dotween.demigiant.com/ 下载地址:http://dotween.demigiant.com/download.php 快速开始:htt ...
- HTTP请求与响应方式
HTTP请求格式 当浏览器向Web服务器发出请求时,它向服务器传递了一个数据块,也就是请求信息,HTTP请求信息由3部分组成: l 请求方法URI协议/版本 l 请求头(Request Hea ...