Проверить this answer. Я думаю, это связано с вашим вопросом.
Для вашего примера вы можете иметь возможность вытягивания в вашей папке с возможностью перемещения. Назовите это чем угодно. Я называю это button_states.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="false"
android:drawable="@drawable/cancel" /> <!-- This can be your image -->
<item
android:state_pressed="true"
android:state_enabled="true"
android:drawable="@color/grey" /> <!-- This can be the color you want to show when the button is pressed. Define this in colors.xml -->
<item
android:state_enabled="true"
android:drawable="@drawable/cancel" /> <!-- Use the same image here -->
</selector>
Наконец-то добавьте это в качестве фона вашего ImageButton. Пример:
<ImageButton
android:id="@+id/imageButtonSelector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_states" />