当你在一个Linearlayout布局中只为一个组件设置android:layout_weight属性时,那么这个组件将默认填充Linearlayout的剩余空间(宽度与高度方向),而不用事先进行测量.此时如果你对该组件的android:layout_width="wrap_content"时就会出现此警告: Use a layout_width of 0dip instead of wrap_content for better performance....... 这是候,你要么把…
安装了最新的ATD 18之后,新加的Lint Warnings插件会给我们检测出许多xml布局中不当的地方,例如: Use a layout_width of 0dip instead of fill_parent for better performance 什么意思呢?举个简单的例子: 这是一个垂直布局,上下的线性布局各占高度50.0dp,中间的的TextView设置了android:layout_weight="1.0"属性,会将剩余空间填充满,这时候TextView的andro…