[工作积累].9图片,不要忘了设定内容填充区域
?
<?xml?version="1.0"?encoding="utf-8"?><LinearLayout?android:id="@+id/test"??xmlns:android="http://schemas.android.com/apk/res/android"??android:layout_width="fill_parent"??android:layout_height="fill_parent"??android:orientation="vertical"??android:background="@drawable/bg">???<LinearLayout?android:id="@+id/test2"? ????android:layout_width="fill_parent"? ????android:layout_height="wrap_content"? ????android:orientation="horizontal">??</LinearLayout>?</LinearLayout>今天遇到了一个郁闷的问题:以上布局获取到的test的w:480但是test2的w:418,即使将宽度写死为480px也一样。
后来经过一步步排查,原来是.9图片的问题,我背景drawable/bg用的是.9图片(大小62x62),当时没有设定填充区域(默认认为不设定的区域为非填充区)...所以480-62=418。加上后再使用就好了。
下次做图时要注意了!