首页 > 移动平台 > 详细

Android常见错误处理(一)

时间:2014-11-30 09:17:00      阅读:144      评论:0      收藏:0      [点我收藏+]

1、Set android:baselineAligned="false" on this element for better performance

如果LinearLayout被用于嵌套的layout空间计算,它的android:baselineAligned属性应该设置成false,以加速layout计算


2、This tag and its children can be replaced by one <TextView/> and a compound drawable

如果我们想用一个TextView和ImageView的组合,并不需要使用这两个组件,只要对TextView使用一个drawable就行了,例如android:drawableTop="....."


3、Missing contentDescription attribute on image

跟Image有关的空间需要一个描述,要解决这个问题的话加上一个空字符或者@string/App_name即可


4、This LinearLayout layout or its LinearLayout parent is possibly useless

在LinearLayout布局当中嵌套了一个子的LinearLayout布局,而在我的这个整个布局文件中是一最外层的LinearLayout为父控件进行整体布局的,从而造成这段布局代码重复了LinearLayout布局。所以只要把多余的LinearLayout去掉就可以了


5、Nested weights are bad for performance

在布局进行嵌套使用时,父布局与子布局都使用了android:layout_weight,但不是必须使用时,便会出现如题所示的警告信息。

Android常见错误处理(一)

原文:http://blog.csdn.net/u012403246/article/details/41620175

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!