How to Change color of over-scroll edge and over-scroll glow or how to change the white color (default color) of android release 5.0 lollipop?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
On
LOLLIPOP
the edge glow inherits fromcolorPrimary
. After the view is created the edge glow color can only be changed through reflection. This can be useful when you load colors dynamically usingPalette
.EDIT: TL;DR: Download the whole class from here: https://github.com/consp1racy/android-commons/blob/master/commons/src/main/java/net/xpece/android/widget/XpEdgeEffect.java
PROGUARD SETUP: If you're going to use this on widgets from support library you need to keep the field names. Quickest way to do it is the following (although still wasteful):
Create a utility class with the following code:
In pre-lollipop the glow effect is actually a Drawable embedded in the OS's resources, you can apply a ColorFilter on that:
Calling it once in onCreate is enough.
The overscroll glow color inherits the primary color value set by
android:colorPrimary
in your entire app. But If you need to specify different value simply useandroid:colorEdgeEffect
.If you're using the latest RecyclerView implementation it is pretty straightforward to change the overflow colour programmatically. Use the following code (Kotlin implementation):
Note that this works only for API level 21 (Lollipop) and above. If you know the value at compile time, use the
colorEdgeEffect
as pointed out by Ahmed.