1
我跟着this tutorial爲Android做了一些更好的按鈕,我也從該網站上拿了9-patch按鈕的例子。它是這一個:9-補丁按鈕顯示不正確
但正如你在下面的圖片中看到的,我的按鈕顯示不正確。
這裏是 「4×4」 按鈕的代碼:
<Button android:id="@+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="starteSpiel"
android:text=" 4 x 4 "
android:background="@drawable/button" />
這裏是我的button.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:state_pressed="false"
android:drawable="@drawable/button_normal" />
<item android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/button_normal" />
<item android:state_focused="false"
android:state_pressed="true"
android:drawable="@drawable/button_normal" />
<item android:drawable="@drawable/button_normal" />
在哪裏錯誤?按鈕應該看起來像tutorial中的那些按鈕。
您可能需要將其保存爲wtiVz.9.png文件擴展名。 – Jems 2011-02-15 14:35:14
是的,就是這樣。謝謝! – Maaalte 2011-02-15 14:44:27