所有原始代码由这个大神写的--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. hdu 4198 Quick out of the Harbour(BFS+优先队列)

    题目链接:hdu4198 题目大意:求起点S到出口的最短花费,其中#为障碍物,无法通过,‘.’的花费为1 ,@的花费为d+1. 需注意起点S可能就是出口,因为没考虑到这个,导致WA很多次....... ...

  2. 把python文件编译成exe文件

    我用的是py2exe. 下载地址http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/ 你可以根绝自己的Python版本选择适当的下载 我 ...

  3. $.each()方法,其实挺不错的

    例子为主 html主要代码 <div class="fl search">厂商:<select id="firms"><optio ...

  4. Python中的多进程与多线程(二)

    在上一章中,学习了Python多进程编程的一些基本方法:使用跨平台多进程模块multiprocessing提供的Process.Pool.Queue.Lock.Pipe等类,实现子进程创建.进程池(批 ...

  5. 部署 instance 到 OVS vlan100 - 每天5分钟玩转 OpenStack(138)

    上一节创建了 OVS vlan network vlan100,今天部署 instance 到该网络.launch 新的 instance “cirros-vm1”,网络选择 vlan100. cir ...

  6. python之路 - 基础3

    1.字符串处理 name = "my name is jiachen" #首字母大写 print (name.capitalize()) #统计字母出现次数 print (name ...

  7. Linux系统下给非root用户添加sudo权限

    Linux系统下给非root用户添加sudo权限 有时,在linux系统中非root用户运行sudo命令,会提示类似信息:  xxx is not in the sudoers file. This ...

  8. 办理康卡迪亚大学(本科)学历认证『微信171922772』Concordia学位证成绩单使馆认证Concordia University

    办理康卡迪亚大学(本科)学历认证『微信171922772』Concordia学位证成绩单使馆认证Concordia University Q.微信:171922772办理教育部国外学历学位认证海外大学 ...

  9. GridView Tab/Enter键插入新行

    此段代码是从DevExpress官方回复文件中得到的.可以用来优化GridView的操作体验. /// <summary> /// GridView添加新行 /// </summar ...

  10. MPICH3.2 单机编译、安装及测试

    MPI,即信息传递接口(Message Passing Interface),是基于消息传递这种并行计算模型的一个并行程序设计标准,可以直接通过C/C++.Fortran调用,目前最主要的实现由MPI ...