线性布局:

<?xml version="1.0" encoding="utf-8"?>
<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" tools:context="com.example.chenshuai.test322.MainActivity"
android:orientation="vertical"
android:gravity="center_horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户名:"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入用户名"/><!--默认值-->
</LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密 码:"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入密码"
android:password="true"/><!--密码输入框-->
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"> <Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="登陆"
android:layout_weight="1"/><!--权重-->
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="注册"
android:id="@+id/button2"
android:layout_weight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="取消"
android:layout_weight="1"/> </LinearLayout> </LinearLayout>

表格布局

<?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:stretchColumns="1,2"> <TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户名:"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_span="2"
android:hint="请输入用户名"/> </TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密码:"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:password="true"
android:layout_span="2"
android:hint="请输入密码"/>
</TableRow>
<TableRow>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="登陆"
android:layout_weight="1"/><!--用权重对应的数值设为0dp-->
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="注册"
android:id="@+id/button2"
android:layout_weight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="取消"
android:layout_weight="1"/>
</TableRow> </TableLayout>

帧布局

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="320dp"
android:height="320dp"
android:layout_gravity="center"
android:background="#f00"/><!--红色-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="280dp"
android:height="280dp"
android:layout_gravity="center"
android:background="#0f0"/><!--绿色-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="240dp"
android:height="240dp"
android:layout_gravity="center"
android:background="#00f"/><!--蓝色-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="200dp"
android:height="200dp"
android:layout_gravity="center"
android:background="#ff0"/><!--黄色-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="160dp"
android:height="160dp"
android:layout_gravity="center"
android:background="#f0f"/><!--紫色--> </FrameLayout>

Android——布局(线性布局linearLayout,表格布局TableLayout,帧布局FrameLayout)的更多相关文章

  1. Android 自学之帧布局 FrameLayout

    帧布局(FrameLayout)直接继承了ViewGroup组件: 帧布局容器为每一个加入其中的组件都创建了一个空白的区域,这个区域我们称之为一帧,所有每个组件都占据一帧,这些都会根据gravity属 ...

  2. Android开发5:布局管理器2(表格布局TableLayout)

    版本:Android4.3 API18  学习整理:liuxinming 概念      TableLayout继承了LinearLayout,因此它的本质依然是线性布局管理器.      表格布局采 ...

  3. Android -- UI布局管理,相对布局,线性布局,表格布局,绝对布局,帧布局

    1. 相对布局 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmln ...

  4. Android五大布局详解——LinearLayout(线性布局)

    Android五大布局 本篇开始介绍Android的五大布局的知识,一个丰富的界面显示总是要有众多的控件来组成的,那么怎样才能让这些控件能够按你的想法进行摆放,从而自定义你所想要的用户界面呢?这就牵涉 ...

  5. Android精通:TableLayout布局,GridLayout网格布局,FrameLayout帧布局,AbsoluteLayout绝对布局,RelativeLayout相对布局

    在Android中提供了几个常用布局: LinearLayout线性布局 RelativeLayout相对布局 FrameLayout帧布局 AbsoluteLayout绝对布局 TableLayou ...

  6. [转]浅谈Android五大布局(二)——RelativeLayout和TableLayout

    在浅谈Android五大布局(一)中已经描述了LinearLayout(线性布局).FrameLayout(单帧布局)和AbsoulteLayout(绝对布局)三种布局结构,剩下的两种布局Relati ...

  7. Android布局管理器(表格布局)

    表格布局有TableLayout所代表,TableLayout继承了LinearLayout,因此他的本质依然是LinearLayout. 表格布局采用行.列的形式来进行管理,在使用的时候不需要声明多 ...

  8. Android笔记(七) Android中的布局——线性布局

    我们的软件是由好多个界面组成的,而每个界面又由N多个控件组成,Android中借助布局来让各个空间有条不紊的摆放在界面上. 可以把布局看作是一个可以放置很多控件的容器,它可以按照一定的规律调整控件的位 ...

  9. 一步一步学android之布局管理器——LinearLayout

    线性布局是最基本的一种布局,在基本控件篇幅中用到的都是LinearLayout,线性布局有两种方式,前面也有用到,一种是垂直的(vertical),一种是水平的(horizontal).我们同样来看下 ...

随机推荐

  1. setsockopt之 TCP_KEEPIDLE/TCP_KEEPINTVL/TCP_KEEPCNT

    setsockopt之 TCP_KEEPIDLE/TCP_KEEPINTVL/TCP_KEEPCNT /*检测网线非法断开*/    setsockopt(iSockFd, SOL_SOCKET, S ...

  2. 算法笔记_046:跳台阶问题(Java)

    目录 1 问题描述 2 解决方案 2.1 递归法 2.2 迭代法   1 问题描述 一个台阶总共有n级,如果一次可以跳1级,也可以跳2级,求总共有多少种跳法. 2 解决方案 2.1 递归法 如果整个台 ...

  3. 实战:sqlserver 日常检查脚本

    --sqlserver 日常检查脚本 print '----------------------------' print ' 0.sqlserver all information ' print ...

  4. activiti自己定义流程之Spring整合activiti-modeler实例(七):任务列表展示

    1.通过上一节的操作,能够知道流程启动以后会同一时候生成一个流程实例和用户任务.这个用户任务保存在act_ru_task和act_hi_task表中,从表明能够看出ru是runtime,hi是hist ...

  5. mindmanager2018优化

      mindmanager2018优化 CreationTime--2018年6月6日09:35:02 Author:Marydon 1.点击“文件”-“选项”进入配置界面,在“常规”选项中,建议勾选 ...

  6. Spring 事务传播行为

    事务传播行为 指定是Spring中一个事务方法调用另一个事务方法时.处理的行为 使用方式: @Transactional(propagation=Propagation.REQUIRED) 事务的使用 ...

  7. python selenium 自动化测试环境安装

    注意:2.7和3.0版本的语法有些不一样 安装自动化测试软件 selenium(地址http://www.seleniumhq.org/download/) 安装步骤: 1.安装pythone运行环境 ...

  8. javascript 图片预加载

    <!DOCTYPE > <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta ...

  9. android使用achartengine 实现折线图

    折线图的实现分为下边几个步骤: 1.第一步:数据的准备 XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset(); XYSeri ...

  10. PHP-Windows下搭建Nginx+PHP环境

    项目中光用Nginx了, 由于有运维人员, 很少搭建Nginx服务器, 开发也就用用Apache, 搭过几次Nginx也忘的快, 每次都去翻别人博客, 今天重搭特此记录, 装前最好了解下FastCGI ...