Android - How do I change background image of a button when its pressed programmatically?
How do I do the following using Java instead of in xml?
<selector xmlns:android="http://schemas.android.com/apk/res/android">
&开发者_StackOverflow中文版lt;item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/title_search_alt"/>
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/title_search_alt"/>
</selector>
Answered here: Replace selector images programmatically
精彩评论