Use a layout_width of 0dip instead of fill_parent for better performance
来源:互联网 发布:人工智能基础教程入门 编辑:程序博客网 时间:2024/06/07 04:43
Use a layout_width of 0dip instead of fill_parent for better performance
举个简单的例子:
这是一个垂直布局,上下的线性布局各占高度50.0dp,中间的的TextView设置了android:layout_weight="1.0"属性,会将剩余空间填充满,这时候TextView的android:layout_width="fill_parent"就没有用了,应该改为android:layout_width="0.0dp"。
我的理解:当设置了比重属性后,在这个方向上的长度就不确定了,不需要再去适配任何属性了,设置了也白设!因为控件都是绘制到屏幕上的,它会根据布局文件初始化控件在屏幕上的显示,所以设置0dip就相当于初始化时不需要绘制了!
0 0
- Use a layout_width of 0dip instead of fill_parent for better performance
- Use a layout_width of 0dip instead of fill_parent for better performance
- Use a layout_width of 0dip instead of fill_parent for better performance
- Use a layout_height of 0dip instead of 700dp for better performance
- Use layout_height of 0dip instead of wrap_content for better Performance
- Use a layout_height of 0dp instead of match_parent for better performance问题说明
- Why Use Git Instead of a Legacy Version Control System
- use supervisor instead of nohup
- How to use SQL store procedure to trace SQL performance instead of SQL profiler
- Use '$' instead of '.' for inner classes (or use only lowercase letters in package names)
- Use '$' instead of '.' for inner classes (or use only lowercase letters in package names) 问题
- use sys_guid() to instead of sequence
- When to Use Delegates Instead of Interfaces
- Effective Objective-C 2.0:Item 50: Use NSCache Instead of NSDictionary for Caches
- 5 Reasons to Use Protocol Buffers Instead of JSON For Your Next Service
- 关于AndroidManifest.xml报Use ' instead of '.' for inner classes....警报的解决办法
- Why don't we use a constructor instead of factory method?
- 干活来袭:Effective Concurrency: Know When to Use an Active Object Instead of a Mutex
- vim 及gcc 指令
- MFC模态对话框和非模态对话框
- 直接拿来用!最火的Android开源项目(完结篇)
- C++:静态局部变量的使用
- 分布式系统阅读笔记(十九)-----移动计算和无处不在的计算
- Use a layout_width of 0dip instead of fill_parent for better performance
- opencv总结
- 使用 Struts 2 开发 RESTful 服务
- 周末要闻回顾:百度宣布员工年终奖金无上限
- android 侧滑菜单的简单实现
- eclipse中添加外部jar包的方法
- less
- 2014:手机游戏中那些正在变迁的元素
- 【新手上路】01背包