【发布时间】:2015-09-14 13:03:40
【问题描述】:
我有以下 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" />
按钮显示一个圆形图像,中间有一个透明的加号。当用户滚动时,我想根据偏移量更改此按钮的颜色。
我尝试使用setBackgroundColor(),但这不是正确的做法,而且它不起作用。应该是我猜的那种色调。
如何动态更改 ImageButton 图片的颜色?
【问题讨论】:
-
对drawable应用颜色过滤器。
标签: java android android-imagebutton