Android基础TOP3:Activity的线性,相对,帧和表格布局的概括
线性布局 LinearLayout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.top3.MainActivity" > <EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入注册用户名"/>
<requestFocus />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入密码"
/> <EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="5"
android:hint="请再次输入密码" > </EditText> <EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入邮箱"/> <Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:background="@drawable/btn_bg"
android:gravity="center"
android:hint="注册" /> </LinearLayout>

相对布局 RelativeLayout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
> <EditText
android:id="@+id/e1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入用户名"
/>
<EditText
android:id="@+id/e2"
android:layout_below="@id/e1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入用户名" /> <Button
android:id="@+id/b2"
android:layout_below="@id/e2"
android:layout_alignRight="@id/e2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册"
/>
<Button
android:id="@+id/b1"
android:layout_below="@id/e2"
android:layout_toLeftOf="@id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登录"
/> </RelativeLayout>

帧布局FrameLyaout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" > <TextView
android:id="@+id/t1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#f00"
android:height="300dp"
android:width="300dp" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#0f0"
android:height="100dp"
android:width="150dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00f"
android:height="50dp"
android:width="100dp" /> </FrameLayout>

表格布局TableLayout:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableRow >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="name"
android:paddingLeft="20dp"
android:textSize="16dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="20dp"
android:textSize="16dp"
/> <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="20dp"
android:textSize="16dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="15dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="15dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="15dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="15dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="achievement"
android:paddingLeft="40dp"
android:textSize="8dp"
/>
</TableRow>
</TableLayout>

Android基础TOP3:Activity的线性,相对,帧和表格布局的概括的更多相关文章
- Android零基础入门第29节:善用TableLayout表格布局,事半功倍
原文:Android零基础入门第29节:善用TableLayout表格布局,事半功倍 前面学习了线性布局和相对布局,线性布局虽然方便,但如果遇到控件需要排列整齐的情况就很难达到要求,用相对布局又比较麻 ...
- Android基础_2 Activity线性布局和表格布局
在activity的布局中,线性布局和表格布局是最简单的,这次分别从线性布局,表格布局以及线性布局和表格混合布局做了实验,实验中只需要编写 相应的xml的代码,java代码不需要更改,因为我们这里只是 ...
- Android基础_3 Activity相对布局
相对布局要比前面讲的线性布局和表格布局要灵活一些,所以平常用得也是比较多的.相对布局控件的位置是与其周围控件的位置相关的,从名字可以看出来,这些位置都是相对的,确定出了其中一个控件的位置就可以确定另一 ...
- android 基础02 - Activity 的生命周期及状态
返回栈 Android 中的 Activity 是可以层叠的,当我们启动一个新的 Activity 时,就会覆盖在原有的 Activity 之上, 点击 Back 会销毁当前 Activity,下面的 ...
- Android 基础 (四大组件,五大存储,六大布局)
Android四大组件: 参考:https://blog.csdn.net/shenggaofei/article/details/52450668 Android四大组件分别为activity.se ...
- Android基础TOP3:线性布局的特点,常用属性,及权重值
线性布局是一种让视图水平或者垂直布排列的布局: 常用属性: androuid:orientation :表示布局方向 取值vertical表示垂直布局 取值horizontal表示水平布局 andro ...
- Android基础之Activity launchMode详解
本文来自http://blog.csdn.net/liuxian13183/ ,引用必须注明出处! Activity的lauchmode,是基础的属性,但也是App优化必须掌握的知识,它约束了Acti ...
- Android基础之Activity四种启动模式
这东西是最基础的,发现自己其实没有真正试过,好好研究研究 standard :默认, singleTop :大体上同standard,但是当该Activity实例已经在task栈顶,不再创建新的实例, ...
- Android基础之Activity
一.什么是Activity Activity是Android四大组件之一,并且Activity是组件中的重中之重. Activity是为用户提供一个用于信息交互的窗口. 二.如何去创建Activity ...
随机推荐
- 转载 - C - 枚举类型详解
出处:http://www.cnblogs.com/JCSU/articles/1299051.html 注:以下全部代码的执行环境为VC++ 6.0 在程序中,可能需要为某些整数定义一个别名,我们可 ...
- Cisco IOU Web Interface : Web IOU
https://github.com/dainok http://sns.clnchina.com.cn/space.php?uid=404779&do=blog&id=4298 ht ...
- ArcGIS For Android 的标绘与可视化
参考 1. CSDN 相关博文 2. ArcGIS for Android 离线数据空间分析--叠加分析 3. ArcGIS for Android Runtime100 基本操作(五)——绘制图层和 ...
- python requests使用
参考:http://cn.python-requests.org/zh_CN/latest/ 1.使用requests发送请求: >>> r = requests.get('http ...
- doT js模板入门 3
for 循环前推断循环的list是否为空 <script id="invoiceListDot" type="text/x-dot-template"&g ...
- Python3基础(二) 基本数据类型
Python中的变量不需要声明.每个变量在使用前都必须赋值,变量赋值以后该变量才会被创建.在Python中,变量就是变量,它没有类型,我们所说的"类型"是变量所指的内存中对象的类型 ...
- Codeforces 446C —— DZY Loves Fibonacci Numbers(线段树)
题目:DZY Loves Fibonacci Numbers 题意比較简单,不解释了. 尽管官方的题解也是用线段树,但还利用了二次剩余. 可是我没有想到二次剩余,然后写了个感觉非常复杂度的线段树,还是 ...
- LeetCode OJ 322. Coin Change DP求解
题目链接:https://leetcode.com/problems/coin-change/ 322. Coin Change My Submissions Question Total Accep ...
- struts2 一个CRUD的BaseAction
在struts2 in action中所见,这样封装后省去了大部分crud反复代码.尽管还不能理悟.先记下来. abstract class BaseAction extends ActionSupp ...
- 解析UML九种图
UML作为设计工具,重在实践上,而这就离不开九种图了.绘图是在看完视频以后进行的,刚開始绘图的时候脑袋懵懵的,不知道该从哪下手,于是就在绘图之前再次的学习了一下这九种图和四种关系.理了 ...