比较LINEARLAYOUT和RELATIVELAYOUT在LISTVIEW中的内存耗用
来源:互联网 发布:餐饮软件安装 编辑:程序博客网 时间:2024/04/30 01:28
图片见:http://www.curious-creature.org/2009/02/22/android-layout-tricks-1/
在LINEARLAYOUT布局里,多用了一个LINEARLAYOUT,造成每一个VIEW建立时都用多
创建一个,资源浪费
The layout pass can be especially expensive when you nest several LinearLayout that use the weight parameter, which requires the child to be measured twice.
有一点区别是,用LinearLayout,当TITLE下的DESC为空时,the application would simply set the visibility of the second TextView to GONE
但是,当用RELATIVE时,如果用DESC来定位TITLE,如果显示不正常
用这个参数 alignWithParentIfMissing
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SimpleAdapter ad = new SimpleAdapter(this,list,R.layout.relative,new String[]{"title","desc"}
,new int[]{R.id.title,R.id.desc}
);
this.setListAdapter(ad);
}
private static String[] title = new String[]{"A","B","C","D"
};
private static String[] desc = new String[]{"aaa1","bbb1",null,null};
private static ArrayList<HashMap<String,String>> list = new ArrayList<HashMap<String,String>>();
static{
HashMap map = null;
for(int i=0;i<title.length;i++){
map = new HashMap();
map.put("title", title[i]);
if(i>=desc.length) continue;
map.put("desc", desc[i]);
list.add(map);
}
}
- 比较LINEARLAYOUT和RELATIVELAYOUT在LISTVIEW中的内存耗用
- LinearLayout和RelativeLayout 比较
- LinearLayout和RelativeLayout 比较
- LinearLayout和RelativeLayout 比较
- LinearLayout和RelativeLayout 比较
- LinearLayout和RelativeLayout的比较
- RelativeLayout和LinearLayout性能比较
- LinearLayout与RelativeLayout在布局中的使用
- 线性布局LinearLayout和相对布局RelativeLayout 比较
- 线性布局LinearLayout和相对布局RelativeLayout 比较
- 线性布局LinearLayout和相对布局RelativeLayout 比较
- 线性布局LinearLayout和相对布局RelativeLayout 之间的比较
- Android 性能优化(六) RelativeLayout和LinearLayout性能比较
- Android学习(二) LinearLayout和RelativeLayout比较
- LinearLayout和RelativeLayout 属性
- LinearLayout 和 RelativeLayout
- LinearLayout和RelativeLayout布局
- LinearLayout和RelativeLayout
- 七、AlwaysVisibleControl——同步卫星
- 开发人员一定要加入收藏夹的网站
- 工作分解结构(WBS Work Breakdown Structure)
- 八、Animation——淡入淡出动画效果
- 清理SQL日志的方法
- 比较LINEARLAYOUT和RELATIVELAYOUT在LISTVIEW中的内存耗用
- 九、AsyncFileUpload——异步上传文件
- 软件加密技术和注册机制
- volatile 变量使用指南
- ANT1.7下载以及配置方法
- 十、AutoComplete——自动完成
- 古之成大事者,不唯有超世之才,亦唯有坚忍不拔之志也!
- 看英文pdf文档屏幕取词
- winform的窗体效果图从左到右显示(在父窗体内下显示)