LinearLayout的嵌套使用
来源:互联网 发布:家电售后软件 编辑:程序博客网 时间:2024/05/17 00:56
在一个页面中,有时候我们需要很复杂的页面布局。单纯的水平垂直已经不能满足我们的需求。这时候就可以使用LinearLayout进行嵌套布局。
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="@+id/text1" android:text="first" android:background="#fff000" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/text2" android:text="secend" android:background="#888000" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginLeft="20dp" > <TextView android:id="@+id/text1" android:text="thired" android:background="#fff000" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/text2" android:text="four" android:background="#888000" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout></LinearLayout>
代码如上,外面的LinearLayout是水平布局,而里面嵌套里两个垂直布局的LinearLayout,结果两个TextView就变成了垂直布局。但是小LinearLayout还是水平布局的。
要看控件用什么布局,看离他最近的LinearLayout是什么布局就行,就近原则。
0 0
- LinearLayout的嵌套使用
- Android布局LinearLayout的嵌套使用
- Android布局之LinearLayout与TableLayout的嵌套使用
- Android LinearLayout布局嵌套及权重weight的使用
- 给android的LinearLayout(里面嵌套…
- ScrollView嵌套Linearlayout显示不全的解决办法
- android中关于使用scrollview嵌套LinearLayout,页面滚动条不到底的解决方法
- ScrollView嵌套LinearLayout又嵌套ListView的布局样式
- 第一章:Linearlayout的使用
- LinearLayout clipChildren的使用
- LinearLayout 的layout_gravity使用
- LinearLayout的layout_weight的使用
- Android应用的LinearLayout中嵌套RelativeLayout的布局用法
- Activity的布局初步(二)嵌套布局【LinearLayout、TableLayout】
- android学习笔记04(LinearLayout的嵌套)
- android LinearLayout嵌套 button时onClickListener不响应的问题
- LinearLayout嵌套RecycleView后无法点击,onClick失效的问题
- SwipeRefreshLayout中嵌套RelativeLayout或者LinearLayout的异常
- 创建 python 虚拟环境及简单使用
- StanfordParser 对文本文件进行句法分析
- WIZ珍藏 #3 : ArtRobot 气象机器人
- Come up and C++ me some time ~ (chapter 1~6)
- 初尝 core.typed
- LinearLayout的嵌套使用
- 利用 Composer 一步一步构建自己的 PHP 框架(一)——基础准备
- HTTP POST GET 本质区别详解
- Spark开发指南(0_8_1中文版)
- 黑马程序员 java基础之数组
- 利用 Composer 一步一步构建自己的 PHP 框架(二)——构建路由
- ARM----------eclipse导入uboot工程以及分步make的方法
- 在Java web项目中防止用户注销后使用浏览器中的“后退”按钮返回注销前页面
- Arcgis Server 服务控制命令