2013-06-13 233 views
0

我有以下9個補丁(穿上了灰色的背景輪廓周圍更清楚地演示):9補丁不尊重填補面積

enter image description here

它橫跨罰款,但填充區域不尊重。我的佈局的內容溢出白色矩形部分。見下文,在我的佈局中的ImageView(紅色矩形)是最左邊的小部件):

enter image description here

將文件保存爲「bg.9.png」。我使用它作爲這些列表視圖項目的背景,如:

<LinearLayout 
    ... 
    android:background="@drawable/bg"> 

任何想法我在這裏失蹤?

感謝

+1

你設置填充LinearLayout在你的代碼中的任何地方?如果是這樣,那將覆蓋九個補丁的內容區域。 – kcoppock

+0

填充沒有設置在任何地方。 – user291701

回答

-1

您必須使用XML資源爲和你的src放入XML

<?xml version="1.0" encoding="utf-8"?> 
<nine-patch xmlns:android="http://schemas.android.com/apk/res/android" 
    android:src="@drawable/bg" > 

</nine-patch> 

,你的血糖應該像bg.9.png