在我的应用程序中,我更改过度滚动发光效果颜色,如下所示:
int glowDrawableId = contexto.getResources().getIdentifier("overscroll_glow", "drawable", "android");
Drawable androidGlow = contexto.getResources().getDrawable(glowDrawableId);
assert androidGlow != null;
androidGlow.setColorFilter(getResources().getColor(R.color.MyColor), PorterDuff.Mode.SRC_ATOP);
Run Code Online (Sandbox Code Playgroud)
但当我更新到棒棒糖这个代码崩溃.我收到以下错误代码:
FATAL EXCEPTION: main
Process: com.myproject.myapp, PID: 954
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1233)
at android.content.res.Resources.getDrawable(Resources.java:756)
at android.content.res.Resources.getDrawable(Resources.java:724)
Run Code Online (Sandbox Code Playgroud)
似乎棒棒糖中缺少overscroll_glow资源.我怎样才能在棒棒糖中实现这一目标?
提前致谢.
我正在寻找一种方法来在使用appcompat材料主题时在RecyclerView pre-lollip中设置过度滚动指示器的颜色.
在内部,它使用EdgeEffect设置为内部可设置属性,除非你已经在棒棒糖(讽刺),否则无法设置.
使用反射不起作用,只能在棒棒糖上设置EdgeEffect的颜色.
在我的API21应用程序上它从主要材料颜色绘制,在Kitkat它是白色的,之前它是全息蓝色,我想要统一我的设计.
关于它是如何完成的任何想法?