更新时间:2023-02-22 13:40:18
,你可以从自己的code见('的setBackground'),你设置纹波为背景这就是为什么它被在背景绘制。
as you can see from your own code ('setBackground') , you're setting the ripple as a BACKGROUND that's why it's being drawn on the background.
在Android API 21 ImageView的添加了这个黑客为纹波的android:drawSelectorOnTop =真正的
。但是,你正在使用的库并没有同样的黑客添加到它。
ImageView on android API 21 added this "hack" for the ripple android:drawSelectorOnTop="true"
. But the library you're using didn't add the same hack to it.
有什么不对本身的code。但是,这种类型的行为不能由Android团队的第三方库得到保障。
There's nothing wrong itself on your code. But this type of behavior cannot be guaranteed by the Android team for 3rd party libraries.
您有几个在这里的选项,将在清洁,努力和表现各不相同:
You have a few of options here that will vary on cleanliness, effort and performance:
KenBurnsView
用的FrameLayout,并使用 setForeground
上的FrameLayout设置纹波。KenBurnsView
with a FrameLayout and set the ripple using setForeground
on the FrameLayout.