边缘褪色的水平recyclerview [英] Horizontal recyclerview with fading edges

查看:133
本文介绍了边缘褪色的水平recyclerview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我查看stackoverflow应用程序的水平recyclerview,我可以看到他们使用了褪色边缘"技术,以便用户可以知道recyclerview的左右两侧都有项目,并且他/她可以滚动.

If I look at the stackoverflow app's horizontal recyclerview, I can see that they use the "fading edge" technique so that the user will know that there are items on the left and right of the recyclerview and he / she can scroll.

在列表视图中,我认为可以通过调用Romain Guy( http://www.curious-creature.com/category/android/page/2/):

In listview, I think this effect is enabled by calling the below as described by Romain Guy (http://www.curious-creature.com/category/android/page/2/):

android:cacheColorHint =#00000000"

android:cacheColorHint="#00000000"

在Recyclerview中,不存在这样的选项.是否有内置方法允许这些褪色的边缘用于recyclerview,还是仅是hack?

No such option exist in Recyclerview unfort. Is there a built in method to allow for these fading edges for recyclerview or will it just have to be a hack?

推荐答案

我认为您要查找的属性是:

I think the attribute you are looking for is:

android:requiresFadingEdge="horizontal|vertical"

您可以从回收者视图的文档.

you can search and better understand this attribute from the recycler view's documentation.

您要讨论的另一个属性'cacheColorHint'可用于使褪色与背景色相匹配.此属性是绘制列表视图时使用的颜色,并定义为

The other attribute you are talking about, 'cacheColorHint', can be used to match the fading color with that of your background. This attribute is the color upon which the list view is drawn, and is defined as an opaque color, because you don't always have a white background (which I think is the default color... but I'm not sure), the best option is to use a transparent color, "#00000000", as suggested by Romain Guy.

希望这就是您要寻找的东西!

Hopefully this is what you are looking for!

欢呼

这篇关于边缘褪色的水平recyclerview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆