Android--->LinearLayout页面布局方式
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页面布局方式的更多相关文章
- android View页面布局总结 最全总结(转)
下面是我在工作中总结的内容,希望对大家有帮助. 一.布局 View的几种布局显示方式有下面几种:线性布局(LinearLayout).相对布局(RelativeLayout).表格布局(TableLa ...
- Android LinearLayout线性布局详解
为了更好地管理Android应用的用户界面里的各组件,Android提供了布局管理器.通过使用布局管理器,Android应用图形用户界面具有良好的平台无关性.推荐使用布局管理器来管理组件的分布.大小, ...
- Web页面布局方式小结
Web页面是由块元素组成的,正常情况下块元素一个个按垂直方向排布,构成了页面.可是这样的主要的布局方式绝大多时候不能满足我们的需求,所以各种布局方式应运而生,本文就对这些布局方式做个小结. 1.元素漂 ...
- Android开发-页面布局
首页布局 首页是ListView的布局 这个还需要制作ListView组件和适配器来显示数据. 关于页面 关于页面显示的是软件的基本信息和软件制作者的信息 这个就是采用基本的页面布局就行.
- 004 Android XML文件常用五大页面布局方式
1.线性布局(LinearLayout)最常用 <1>使用线性布局,首先在xml文件中修改布局为LinearLayout 修改完成后,可在Component Tree中看见如下内容: &l ...
- Android linearlayout常用布局
用linearlayout完成这样的布局效果,这样的布局还是比较常用的,具体的xml代码如下: <LinearLayout xmlns:android="http://schemas. ...
- Android四种布局方式
线性布局 <LinearLayout android:layout_width="match_parent" android:layout_height="wrap ...
- Android LinearLayout线性布局
LinearLayout是线性布局控件:要么横向排布,要么竖向排布 决定性属性:必须有的! android:orientation:vertical (垂直方向) .horizontal(水平方向) ...
- Android LinearLayout整个布局设置不可点击
1,activity的xml布局(布局中有个Button按钮,点击按钮弹出一个popupwindow ) <?xml version="1.0" encoding=" ...
随机推荐
- linux手工笔记
一.vi编辑器常用命令: -------------------------------- •插入文字:I键A键 •退回命令模式:ESC •存盘:w •不存盘退出:q •存盘退出:wq •强制退出:q ...
- unlinking
When a file name is deleted from the directory tree, the file name's connection to the inode number ...
- how computer boot up?
The power button activates the power supply in the PC, sending power to the motherboard and other co ...
- git 命令参考手册 git中文命令参考手册大全
git init # 初始化本地git仓库(创建新仓库)git config --global user.name "xxx" # 配置用户名git config --global ...
- MySQL 索引 总结
1.索引的种类(六种) 普通索引,唯一索引,全文索引,单列索引,多列索引,空间索引 2.优缺点及注意事项 优点:有了索引,对于记录数量很多的表,可以提高查询速度. 缺点:索引是占用空间的,索引会影响u ...
- fatal error: gst/gst.h
ln命令使用 ln -s 源文件(src) 目标文件(dest) 进到这个文件:~/LowDA/sysroots/mx6q/usr/include$ ln -s gstreamer-0.10/gs ...
- 对象之function
开头啰嗦几句:程序之中,万事万物皆对象,这就是面向对象编程的核心思想,比如我们的js中的function,其实也是一个对象,是对象就可以有属性,在jq的源码中经常看到类似这样的方法: jQuery.E ...
- javascript IP验证
//IP验证function isIP(strIP){try{if(strIP.length<7){return false;}var re=/^(\d+)\.(\d+)\.(\d+)\.(\d ...
- 转 : net use的使用
老是忘了 net use 怎么样,今天在网上找一篇,贴在这,感谢原作者分享. 1 查看远程主机的共享资源(但看不到默认共享) net view \\IP 2向远程主机复制文件 copy \路径 ...
- 1.1 整理的Linux 基础
本文总参照:http://blog.csdn.net/xiaoguaihai/article/details/8705992/ 2.用户管理操作命令 (1)Su - XX 切换用户 3.文件管理操作命 ...