android - ListView 的自定义滚动发光/边缘颜色?

标签 android android-layout android-widget android-listview

我有一个 ListView 和一个基本上看起来像 Holo 的自定义样式,但带有黄色而不是蓝色。

当我滚动到列表的底部或顶部时,我看到了不合适的蓝色。我为 overscroll_glow.pngoverscroll_edge.png 制作了自定义绘图,但我不知道如何使用它们。

如何让我的 ListView 使用这些可绘制对象而不是系统可绘制对象?

OverScroller 类有帮助吗?

最佳答案

您可以使用类似反射的解决方案来改变这种发光颜色:

int glowDrawableId = context.getResources().getIdentifier("overscroll_glow", "drawable", "android");
Drawable androidGlow = context.getResources().getDrawable(glowDrawableId);
androidGlow.setColorFilter(brandColor, PorterDuff.Mode.MULTIPLY);

我遇到了同样的问题,这似乎是一个很好的解决方案,至少在 Google 添加用于更改颜色(或标记颜色)的 API 之前是这样:http://evendanan.net/android/branding/2013/12/09/branding-edge-effect/

关于android - ListView 的自定义滚动发光/边缘颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12102108/

相关文章:

java - AIDL服务和Android开源

Android - 小部件上的动画

android - 触摸 SwitchCompat 小部件不会更改 SwitchPreference 值

android - 如何将嵌套的 LinearLayout 对齐到顶部

android - 选择器的奇怪行为

android - 无法让省略号在 Android 上工作

android - 为什么在测量自定义 View /布局时 MaterialAlertDialog 这么慢?

android - 如何在 Eclipse 中使用 Google 提供的 Android Design Pack

python - 未安装 SDK 管理器

Android - 更小的 ActionBar 选项卡