Android 布局之LinearLayout


1 LinearLayout简介

LinearLayout是线程布局。它包括2个方向(android:orientation):“水平”(horizontal)和“竖值”(vertical)。


2 LinearLayout示例

创建一个activity,包含2组LinearLayout:一组LinearLayout中包含3个文本,文本是水平排列;另一组LinearLayout中包含3个文本,文本是竖值排列。

layout文件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tooRelativeLayoutls="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#CC0000"
android:text="@string/text_1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00CC00"
android:text="@string/text_2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#0000CC"
android:text="@string/text_3" />
</LinearLayout> <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_3" />
</LinearLayout>
</LinearLayout>

点击下载:源代码

运行效果:

Android 布局之LinearLayout的更多相关文章

  1. Android布局之LinearLayout

    LinearLayout 1.核心属性 高度:layout_height   (基于内容 wrap_content:基于父控件:) 宽度:layout_width 方向:orientation  (纵 ...

  2. Android 布局之LinearLayout 子控件weight权重的作用详析(转)

    关于Android开发中的LinearLayout子控件权重android:layout_weigh参数的作用,网上关于其用法有两种截然相反说法: 说法一:值越大,重要性越高,所占用的空间越大: 说法 ...

  3. Android 布局之LinearLayout 子控件weight权重的作用详析

    关于Android开发中的LinearLayout子控件权重android:layout_weigh参数的作用,网上关于其用法有两种截然相反说法: 说法一:值越大,重要性越高,所占用的空间越大: 说法 ...

  4. android 布局之LinearLayout(学习一)

    一,View localView = mRadioGroup_content.getChildAt(i);指定自定义菜单栏的点击格,如child3 其中:mRadioGroup_content = ( ...

  5. Android布局管理详解(1)—— LinearLayout 线性布局

    Android的布局方式共有6种,分别是LinearLayout(线性布局).TableLayout(表格布局).FrameLayout(帧布局).RelativeLayout(相对布局).GridL ...

  6. Android布局及属性归总(查询用)

    常见布局 LinearLayout    线性布局        子元素任意,组织成一个单一的水平或垂直行,默认为水平方向TableLayout    表格布局        子元素为<Tabl ...

  7. Android中的LinearLayout布局

    LinearLayout : 线性布局 在一般情况下,当有很多控件需要在一个界面列出来时,我们就可以使用线性布局(LinearLayout)了,  线性布局是按照垂直方向(vertical)或水平方向 ...

  8. Android的学习第六章(布局一LinearLayout)

    今天我们来说一下Android五大布局-LinearLayout布局(线性布局) 含义:线性布局,顾名思义,指的是整个Android布局中的控件摆放方式是以线性的方式摆放的, 主要作用:主要对整个界面 ...

  9. android布局学习-使用FrameLayout和LinearLayout制作QQ空间底部导航栏

    [声明:本博客通过学习“J灬叶小超 ”博客而写,链接:http://www.cnblogs.com/yc-755909659/p/4288260.html] --------------------- ...

随机推荐

  1. Swift - 实现点击cell动态修改高度

    Swift - 实现点击cell动态修改高度 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TapCellAnimationC ...

  2. 未能加载文件或程序集“System.Data.SQLite.DLL”或它的某一个依赖项

    今天在部署code到测试环境的时候 出现了未能加载文件或程序集"System.Data.SQLite.DLL"或它的某一个依赖项 这个错误,其实错误的的原因有很多,1.典型的是是版 ...

  3. 一个4节点Hadoop集群的配置示例

    环境: 操作系统:CentOS 6.5 64bit Hadoop:Version 1.2.1 Servers:hadoopnamenode,hadoop2ndnamenode,hadoopdatano ...

  4. 努力学习 HTML5 (3)—— 改造传统的 HTML 页面

    要了解和熟悉 HTML5 中的新的语义元素,最好的方式就是拿一经典的 HTML 文档作例子,然后把 HTML5 的一些新鲜营养充实进入.如下就是我们要改造的页面,该页面很简单,只包含一篇文章. Apo ...

  5. Android系列---JSON数据解析

    您可以通过点击 右下角 的按钮 来对文章内容作出评价, 也可以通过左下方的 关注按钮 来关注我的博客的最新动态. 如果文章内容对您有帮助, 不要忘记点击右下角的 推荐按钮 来支持一下哦 如果您对文章内 ...

  6. nginx模块开发篇 (阿里著作)

    背景介绍 nginx历史 使用简介 nginx特点介绍 nginx平台初探(100%) 初探nginx架构(100%) nginx基础概念(100%) connection request 基本数据结 ...

  7. Delphi中设置条件断点

    写了这么长时间的代码,一直认为调试程序比写程序要重要,上次有人问俺,如何调试一个循环中某个循环条件位置下断点.本来想来在Delphi的断点设置中应该是有一个类似条件断点的东西的,不过我也一直不知道怎么 ...

  8. jquery.pjax.js bug问题解决集锦

    jquery.pjax 是一个很好的局部刷新插件,但实际应用过程是还是会有很多小问题,部分问题解决如下: 1.pjax 局部加载时候,IE 存在缓存问题,很容易理解,pjax是通过jquery的aja ...

  9. C# 代码转化为Java代码

    http://www.tangiblesoftwaresolutions.com/Free_Editions.html Install Instant C# (converts VB.NET code ...

  10. [论文笔记] Methodologies for Data Quality Assessment and Improvement (ACM Comput.Surv, 2009) (2)

    本篇博文主要对DMQ(S3.7)的分类进行了研读. 1. 这个章节提出了一种DQM的分类法(如下图) 由上图可见,该分类法的分类标准是对assessment & improvement阶段的支 ...