首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

[工作累积].9图片,不要忘了设定内容填充区域

2012-09-22 
[工作积累].9图片,不要忘了设定内容填充区域??xml?version1.0?encodingutf-8?LinearLayout?andro

[工作积累].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。加上后再使用就好了。
下次做图时要注意了!

热点排行