Android ImageButton with a selected state?

This works for me: <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <!– NOTE: order is important (the first matching state(s) is what is rendered) –> <item android:state_selected=”true” android:drawable=”@drawable/info_icon_solid_with_shadow” /> <item android:drawable=”@drawable/info_icon_outline_with_shadow” /> </selector> And then in java: //assign the image in code (or you can do this in your layout xml with the src attribute) imageButton.setImageDrawable(getBaseContext().getResources().getDrawable(R.drawable….)); //set … Read more