是否可以更改列表视图的 FadingEdge 的颜色?
我想给出这样的效果:ListView 已经从它周围的任何东西中消失了。默认情况下,它设置为 ListView 的任何颜色。我可以调整 FadingEdge 的方向和 FadingEdge 的大小,但不能调整颜色。是否可以?
I want to give the effect that the ListView has faded from whatever is around it. By default it is set to whatever colour your ListView is. I can adjust the orientation of the FadingEdge and the size of the FadingEdge but not the colour. Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(3)
北恋2024-10-06 22:10:07
你可以尝试这个(我知道这是一个黑客):
int glowDrawableId = context.getResources().getIdentifier("overscroll_glow", "drawable", "android");
Drawable androidGlow = context.getResources().getDrawable(glowDrawableId);
androidGlow.setColorFilter(brandColor, PorterDuff.Mode.MULTIPLY);
我利用了发光效果实际上是一个共享的 Drawable 的事实,并在其上应用了一个过滤器: http://evendanan.net/android/branding/2013/12/09/branding-edge-effect/
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
您需要创建一个扩展 ListView 的新类。
您可以像普通;
ListView
一样使用此列表视图(尽管您必须正确转换它才能使用 fadeColor 访问器方法)。在 XML 中,不要将对象定义为
将其定义为You'll need to create a new class that extends ListView.
You can use this list view identically to a normal
ListView
(though you'll have to cast it properly to use the fadeColor accessor methods). In your XML, instead of defining an object as<ListView android:properties.../>
define it as<com.mypackage.ColorFadeListView android:properties.../>