日々精進

新しく学んだことを書き留めていきます

2015-03-16から1日間の記事一覧

selectorリソースを使ってボタンの背景画像を切り替えられない

原因は、XMLファイル内の一番上にAttributeが付いていないitemを書いていたため。 selectorは上から順に評価されるので、常に一番上の画像を表示してしまっていた。 以下はだめな例。 <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/common_sell_radio_button"/> </item></selector>