ボタンのカスタム背景に問題があります。私の9パッチがあります:
Draw 9 パッチでも同じ:
最後に、デバイスの画面に表示される結果:
そして、それが私のボタンを説明するコードです:
レイアウト:
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="New Button"
style="@style/button"/>
スタイル:
<style name="button">
<item name="android:background">@drawable/button</item>
<item name="android:textColor">@color/button_text</item>
</style>
@drawable/button
:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" >
<bitmap android:src="@drawable/button_test"/>
</item>
</selector>
res フォルダー内のドローアブルのファイル名は、button_test.9.png です。
なぜうまくいかないのか、何か考えはありますか?ありがとうございました。