`
univasity
  • 浏览: 801507 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

[工作积累].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。加上后再使用就好了。

下次做图时要注意了!
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics