9.png(9位图)在android中作为background使用导致居中属性不起作用的解决方法
在使用到9.png的布局上面添加
?android:padding="0dip"
?
比如
?
<LinearLayout
? ? ? ? ? ? android:layout_width="match_parent"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:layout_margin="20dp"
? ? ? ? ? ? android:layout_marginRight="10dp"
? ? ? ? ? ? android:orientation="vertical"
? ? ? ? ? ? android:layout_weight="1"
? ? ? ? ? ? android:background="@drawable/sysbtnblue"
? ? ? ? ? ? android:padding="0dip"
? ? ? ? ? ??? ?>
解決方法來源
http://stackoverflow.com/questions/3904852/android-layout-broken-with-9-patch-background
轉載于:https://my.oschina.net/liangzhenghui/blog/277663
總結
以上是生活随笔為你收集整理的9.png(9位图)在android中作为background使用导致居中属性不起作用的解决方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java 工厂模式的写法_java简单工
- 下一篇: 两个sql交集_sql的高级命令运用