安卓UI布局常见警告

Set android:baselineAligned="false" on this element for better performance
如果LinearLayout被用于嵌套的layout空间计算,它的android:baselineAligned属性应该设置成false,以加速layout计算
android:baselineAligned="false"

This LinearLayout layout or its RelativeLayout parent is useless;
多余的Linearlayout或者RelativeLayout
删除即可

This tag and its children can be replaced by one <TextView/> and a compound   drawable
有时候我们可能会用image+textview组合,但其实image是没必要的,textview提供了一个属性来给它设置image
android:drawable="@drawable/resource"

Use a layout_height of 0dip instead of wrap_content for better   performance
当在一个linearlayout布局中为一个控件设置weight属性时,这个 组件会默认填充剩余空间
去掉weight属性或者修改wrap_content为0dp

Buttons in button bars should be borderless
两个 Buttons 放在一个布局里会被判断为按钮栏,需要添加样式取消它的边框。
style="?android:attr/buttonBarButtonStyle"

Missing contentDescription attribute on image
缺少图片描述,在 ADT 16 开始会抛出这个警告,确保开发者为图片添加内容描述。
为图片添加 android:contentDescription="@string/desc" 属性。

This text field does not specify an inputType or a hint
原因是这个编辑框缺少一个提示属性:hint。
为编辑框添加 android:hint="@null"或者"提示内容"属性

猜你喜欢

转载自blog.csdn.net/m_pfly_fish/article/details/47782201
今日推荐