寒假学干货之------LinearLayout.layout.weight
所有原始代码由这个大神写的--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的更多相关文章
- 寒假学干货之------初步布局Layout
在开发的最初,需要设计好我们的Activity,在res/layout下,找到**activitymian(名字都差不多的)的.xml文件,打开他就可以开始编辑. http://www.tuicool ...
- 寒假学干货之------ 初学者关于fragment_main(碎片的困扰)
我们在activity_main中编写的框架,会被fragment_main中的取代掉,是因为新版的ADT为了配合平板Android3.0开发 起作用的代码在MainActivity.java中 pa ...
- 寒假学干货之------android开发环境
1.下载安装jdk(http://www.oracle.com/technetwork/java/javase/downloads/index.html)装se版的就可以了,复制jdk目录路径,之后配 ...
- [Android开发学iOS系列] Auto Layout
[Android开发学iOS系列] Auto Layout 内容: 介绍什么是Auto Layout. 基本使用方法 在代码中写约束的方法 Auto Layout的原理 尺寸和优先级 Auto Lay ...
- 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. ...
- AndroidのUI布局之layout weight
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- Android LinearLayout中weight属性的意义与使用方式
layout_weight 分割父级容器的比例
- 一步一步学android之布局管理器——LinearLayout
线性布局是最基本的一种布局,在基本控件篇幅中用到的都是LinearLayout,线性布局有两种方式,前面也有用到,一种是垂直的(vertical),一种是水平的(horizontal).我们同样来看下 ...
- 如何优化你的布局层级结构之RelativeLayout和LinearLayout及FrameLayout性能分析
转载请注明出处:http://blog.csdn.net/hejjunlin/article/details/51159419 如何优化你的布局层级结构之RelativeLayout和LinearLa ...
随机推荐
- 调用一个Activity并返回结果
一:在main.xml文件中设置布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android&q ...
- hdu 1166 敌兵布阵(线段树基础题)
学习线段树~~~~~~~~~~~~要好好理解 此题是单点更新的线段树,考虑基本的询问,更新. #include <iostream> #include <algorithm> ...
- .NET 基础 一步步 一幕幕[面向对象之堆、栈、引用类型、值类型]
堆.栈.引用类型.值类型 内存分为堆和栈(PS:还有一种是静态存储区域 [内存分为这三种]),值类型的数据存储在栈中,引用类型的数据存储在堆中. 堆.栈: 堆和栈的区别: 栈是编译期间就分配好的内存空 ...
- Nopcommerce架构浅谈之架构层次
前面谈到了系统的文件,从文件结构中我们也可以看出Nop的层次划分还是非常清晰,下面我将介绍下Nop的架构层次,并对每个层做简要的介绍,先看我画的层次图. 这个系统基本上按照了ddd的形式做了划分,我本 ...
- 【SQL】T-SQL基本语法复习
数据库基本的几个对象 数据表.视图.存储过程.索引.触发器.函数 增删改查 Insert into test(name,sex,ago) values ('陈三','男',20) Update tes ...
- Ubuntu16 64位安装steam, 并解决无法启动的问题
直接用crtl+shift打开终端,运行下面的命令. sudo add-apt-repository multiverse sudo apt update sudo apt install steam ...
- SpringMVC Memcached 搭建WEB项目缓存框架
最近做的项目一直在使用memcached作为缓存来缓存各种数据,现在BOSS要在项目上加上缓存.并把任务交给我.便琢磨怎么解决这个问题. 看了很多文章,写的比较详尽靠谱的就是这篇了http://www ...
- js在关闭页面前弹出确认提示【转载】
最近项目中出现个bug,就是导出数据后,会提示确认导航,其实实际需求并不需要这个提示,可能是之前遗留的问题.查了下资料是在触发了onbeforeunload事件,那么剩下的就是代码组织问题了. 众所周 ...
- nginx使用openssl的证书-泛解析
一.需求分析 我们公司测试环境,域名更换,原来的*.dev.devbao.cn 变为 *.dev.vdai.cn ,此处的*表示多个二级域名,导致原来为dev.devbao.cn制作的ssl ...
- java操作mongodb——插入数据
在mongodb中,表(Table)被称之为集合(Collection),记录(Record)被称为文档(Document) 首先连接到数据库 MongoClient mongoClient = ne ...