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=" ...
随机推荐
- apache 添加到windows服务
cmd命令行下 输入 “d:\apache\bin\httpd.exe” -k install 如果是resin的话直接运行目录下的setup就可以了, 前提是需要.net framework 3.5
- hdu_3966_Aragorn's Story(树链剖分裸题)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3966 题意:给你一棵树,然后给定点之间的路径权值修改,最后单点查询 题解:树链剖分裸题,这里我用树状数 ...
- Shell脚本,自动化发布tomcat项目【转】
Shell脚本,自动化发布tomcat项目脚本. 1. vko2c_auto_build_by_scp.sh 文件内容: #---------------------start------------ ...
- textFiled输入字数的控制问题之—把带输入的拼音也判断了
一个textFiled,控制只能输入五个字,现在你已经输入了四个字,在输入第五个字的时候,输入一个拼音之后就不能输入后一个拼音,这里把拼音也当成字来判断了,这种情况下就需要_textFiled.mar ...
- 更改JFram标题栏图标
方式一: package com.swing.test; import javax.swing.ImageIcon; import javax.swing.JFrame; public class a ...
- C# 引用参数
最近经常和同事讨论引用参数的问题,为了搞清楚,查了些资料,其中CLR via C#中讲的比较清楚,整理了下 ----摘自(CLR via C#) 在默认情况下,CLR假设所有的方法参数都是按值传递的. ...
- 编译使用tinyxml
环境: win7 32位旗舰版,VS2010,tinyxml_2_6_2版本 1.下载tinyxml,并解压到tinyxml文件夹下 2.生成动态链接库 原生的Tinyxml只支持静态库(没有在.h文 ...
- boost库之geometry
环境:win732位旗舰版.VS2010旗舰版.boost 1.55.0版本.坐标系为MM_TEXT Geometry是一个开源的几何计算库,包含了几何图形最基本的操作(也支持复杂的操作),下面我们看 ...
- Java BigDecimal Class
Using BigDecimal to perform precise calculations with floats. BigDecimal is a class type. So declare ...
- Trie/Xor
题目链接 /*有一个数组a1,a2,a3--an.找到一个连续子段[l,r],使得al ^ al+1 ^--^ ar达到最大. 一般思路:维护前缀异或+暴力: for(int i=1;i<=n; ...