所有原始代码由这个大神写的--http://www.cnblogs.com/zhangs1986/archive/2013/01/17/2864237.html

layout/activity_main下

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.myprogram.text_two.MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="//这里是2 下面效果图
        android:orientation="horizontal">

        <Button...
        <Button...

        <Button...
        <Button...
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="//这里是1
        android:orientation="vertical" >

        <Button...
        <Button...

        <Button...

        <Button...
    </LinearLayout>
</LinearLayout>

接下来我们,在上面的weight赋值1,下面的赋值2

可以看见,第一种是2:1显示的1:2,是相反的。

寒假学干货之------LinearLayout.layout.weight的更多相关文章

  1. 寒假学干货之------初步布局Layout

    在开发的最初,需要设计好我们的Activity,在res/layout下,找到**activitymian(名字都差不多的)的.xml文件,打开他就可以开始编辑. http://www.tuicool ...

  2. 寒假学干货之------ 初学者关于fragment_main(碎片的困扰)

    我们在activity_main中编写的框架,会被fragment_main中的取代掉,是因为新版的ADT为了配合平板Android3.0开发 起作用的代码在MainActivity.java中 pa ...

  3. 寒假学干货之------android开发环境

    1.下载安装jdk(http://www.oracle.com/technetwork/java/javase/downloads/index.html)装se版的就可以了,复制jdk目录路径,之后配 ...

  4. [Android开发学iOS系列] Auto Layout

    [Android开发学iOS系列] Auto Layout 内容: 介绍什么是Auto Layout. 基本使用方法 在代码中写约束的方法 Auto Layout的原理 尺寸和优先级 Auto Lay ...

  5. Waring:This LinearLayout layout or its FrameLayout parent is useless; transfer the background attribute to the other view

    解决方法请参考: You have a single component (row) vertical linear layout, containing another linear layout. ...

  6. AndroidのUI布局之layout weight

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  7. Android LinearLayout中weight属性的意义与使用方式

    layout_weight 分割父级容器的比例

  8. 一步一步学android之布局管理器——LinearLayout

    线性布局是最基本的一种布局,在基本控件篇幅中用到的都是LinearLayout,线性布局有两种方式,前面也有用到,一种是垂直的(vertical),一种是水平的(horizontal).我们同样来看下 ...

  9. 如何优化你的布局层级结构之RelativeLayout和LinearLayout及FrameLayout性能分析

    转载请注明出处:http://blog.csdn.net/hejjunlin/article/details/51159419 如何优化你的布局层级结构之RelativeLayout和LinearLa ...

随机推荐

  1. 【2013Esri全球用户大会精彩看点】ArcGIS 10.2移动产品新特性

    Ø 全新的应用Explorer for ArcGIS 在2013年第四季度,Esri将发布全新的应用Explorer for ArcGIS,它将联合Collector和Operations Dashb ...

  2. docker的网络-Container network interface(CNI)与Container network model(CNM)

    Overview 目前围绕着docker的网络,目前有两种比较主流的声音,docker主导的Container network model(CNM)和社区主导的Container network in ...

  3. OGG学习笔记01-基础概述

    OGG学习笔记01-基础概述 OGG(Oracle Golden Gate),最近几年在数据同步.容灾领域特别火,甚至比Oracle自己的原生产品DataGuard还要风光,主要是因为其跨平台.跨数据 ...

  4. [ios2] 获取mac地址 等唯一标识

    - (NSString *) macaddress{        int                 mib[6];    size_t              len;    char    ...

  5. 一个问题:关于finally中return吞掉catch块中抛出的异常

    今天遇到一个感觉很神奇的问题,记录一下问题以及自己分析问题的思路. 预警:不知道怎么看java字节码的朋友可能需要先看一下如何阅读java字节码才能看懂后面的解释. 我有一段程序: public cl ...

  6. HTML target 属性

    定义和用法 <a> 标签的 target 属性规定在何处打开链接文档. 如果在一个 <a> 标签内包含一个 target 属性,浏览器将会载入和显示用这个标签的 href 属性 ...

  7. iOS开发-OC语言 (六)点语法和@property

    点语法和@property 知识点 1.setter/getter函数 2.点语法 3.@property语法和属性 ======================================== ...

  8. KMS服务器搭建

  9. trove最新命令简单分类解析

    usage: trove [--version] [--debug] [--service-type <service-type>] [--service-name <service ...

  10. Web.config 文件中的 system.webServer

    Web.config 文件中的 system.webServer 节用于指定适用于 Web 应用程序的 IIS 7.0 设置.system.WebServer 是 configuration 节的子级 ...