main.xml布局方式

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"> <!-- 第一个布局,layout_weight="1"空间占比例为1,horizontal水平布局 -->
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<!-- 在第一个布局区域中,第一个布局,gravity文字位置,这里表示居中,所占比例为1 -->
<TextView
android:text="红色"
android:gravity="center_horizontal|center_vertical"
android:background="#aa0000"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<!-- 在第一个布局区域中,第一个布局,gravity文字位置,这里表示水平居中,所占比例为1 -->
<TextView
android:text="绿色"
android:gravity="center_horizontal"
android:background="#00aa00"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<!-- 在第一个布局区域中,第二个布局,gravity文字位置,这里表示中下,所占比例为1 -->
<TextView
android:text="蓝色"
android:gravity="center|bottom"
android:background="#0000aa"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<!-- 在第一个布局区域中,第三个布局,gravity文字位置,这里表示下,默认为左边,所占比例为1 -->
<TextView
android:text="黄色"
android:gravity="bottom"
android:background="#aaaa00"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</LinearLayout>
<!-- 第二个布局,layout_weight="1"空间占比例为1,此时只有两个LinearLayout,表示分半,horizontal水平布局 -->
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:text="第一行"
android:textSize="15sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="第二行"
android:textSize="15sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="第三行"
android:textSize="15sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="第四列"
android:textSize="15sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>

Android--->LinearLayout页面布局方式的更多相关文章

  1. android View页面布局总结 最全总结(转)

    下面是我在工作中总结的内容,希望对大家有帮助. 一.布局 View的几种布局显示方式有下面几种:线性布局(LinearLayout).相对布局(RelativeLayout).表格布局(TableLa ...

  2. Android LinearLayout线性布局详解

    为了更好地管理Android应用的用户界面里的各组件,Android提供了布局管理器.通过使用布局管理器,Android应用图形用户界面具有良好的平台无关性.推荐使用布局管理器来管理组件的分布.大小, ...

  3. Web页面布局方式小结

    Web页面是由块元素组成的,正常情况下块元素一个个按垂直方向排布,构成了页面.可是这样的主要的布局方式绝大多时候不能满足我们的需求,所以各种布局方式应运而生,本文就对这些布局方式做个小结. 1.元素漂 ...

  4. Android开发-页面布局

    首页布局 首页是ListView的布局 这个还需要制作ListView组件和适配器来显示数据. 关于页面 关于页面显示的是软件的基本信息和软件制作者的信息 这个就是采用基本的页面布局就行.

  5. 004 Android XML文件常用五大页面布局方式

    1.线性布局(LinearLayout)最常用 <1>使用线性布局,首先在xml文件中修改布局为LinearLayout 修改完成后,可在Component Tree中看见如下内容: &l ...

  6. Android linearlayout常用布局

    用linearlayout完成这样的布局效果,这样的布局还是比较常用的,具体的xml代码如下: <LinearLayout xmlns:android="http://schemas. ...

  7. Android四种布局方式

    线性布局 <LinearLayout android:layout_width="match_parent" android:layout_height="wrap ...

  8. Android LinearLayout线性布局

    LinearLayout是线性布局控件:要么横向排布,要么竖向排布 决定性属性:必须有的! android:orientation:vertical (垂直方向) .horizontal(水平方向) ...

  9. Android LinearLayout整个布局设置不可点击

    1,activity的xml布局(布局中有个Button按钮,点击按钮弹出一个popupwindow ) <?xml version="1.0" encoding=" ...

随机推荐

  1. vbs 读取txt是读取特定的行

    读取第三行的内容:Set fso = CreateObject("scripting.filesystemobject")path="A.TXT文件的路径"Se ...

  2. LeetCode OJ 113. Path Sum II

    Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...

  3. Oracle用户密码过期和用户被锁解决方法【转】

    [原因/触发因素] 确定是由于Oracle11g中默认在default概要文件中设置了“PASSWORD_LIFE_TIME=180天”所导致. [影响和风险] 影响 密码过期后,业务进程连接数据库异 ...

  4. PHP的抽象类、接口类的区别和选择【转载】

    本文转自:http://blog.csdn.net/fanteathy/article/details/7309966 区别: 1.对接口的使用是通过关键字implements.对抽象类的使用是通过关 ...

  5. linux 进程监控和自动重启的简单实现

    目的:linux 下服务器程序会因为各种原因dump掉,就会影响用户使用,这里提供一个简单的进程监控和重启功能. 实现原理:由定时任务crontab调用脚本,脚本用ps检查进程是否存在,如果不存在则重 ...

  6. Qt Creator下载和安装(详细教程)

    简介 Qt是跨平台的图形开发库,目前由Digia全资子公司 Qt Company 独立运营,官方网址: http://www.qt.io/ 也可以访问Qt项目域名:http://qt-project. ...

  7. storm serializable

    http://www.programgo.com/article/68283366567/

  8. 关于项目刚才还能运行的,重启Myeclipse就不能运行(报错)的解决方法

    这个是以为内存不足引起的,就是打开MyEclipse的时候,因为内存不足,没有加载完整的项目,这个时候需要重启电脑,即可解决问题.

  9. cfdiv2/c/找规律

    题目连接 £:若n<4,NO: £:若n==4,特判,n==5,特判. £:若n>=6,用2-4组成24,1和5和6组成零,即可. #include <set> #includ ...

  10. easyui formatter 返回easyui组件

    <table id="dg2" title="标题" style="width:400px;float: left;"> < ...