境界線でのみ強調したいボタンがいくつかあります。
つまり、実行したアクションでボタンの境界線を特定の色で光らせたいのです。プログラムで境界線を変更するにはどうすればよいですか?
ドローアブルで可能ですか?どのように?
選択した状態用と通常の状態用の2つのドローアブルを使用できます。次のリンクを参照してください。
ここを参照してください: http://developer.android.com/reference/android/widget/ImageButton.html
また、ここ: http://groups.google.com/group/android-developers/tree/browse_frm/thread/1906f24707594f67/17322a04f7af1a5b Romain Guy の回答:
res/drawable で、たとえば mybutton_background.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_background_focus" />
<item android:state_focused="true" android:state_pressed="true"
android:drawable="@drawable/button_background_pressed" />
<item android:state_focused="false" android:state_pressed="true"
android:drawable="@drawable/button_background_pressed" />
<item android:drawable="@drawable/button_background_normal" />
</selector>
次に、このドローアブルをボタンの背景として設定します
android:background="@drawable/mybutton_background"