I have the following Android ImageButton:
<ImageButton
android:id="@+id/myButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_button"
android:background="@null" />
The button displays a circle image with a transparent plus in the middle. When the user is scrolling I want to change the color of this button based on the offset.
I tried using setBackgroundColor()
but this is not the correct way of doing it and it does not work. It must be more the tint color I guess.
How can I change the color of the ImageButton image dynamically?