带有褪色边缘的水平回收视图 [英] Horizontal recyclerview with fading edges

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

问题描述

如果我查看stackoverflow应用程序的水平recyclerview,我可以看到他们使用了fading edge"技术,这样用户就会知道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 unfort 中不存在这样的选项.是否有内置方法可以为 recyclerview 提供这些褪色边缘,或者它只是一个黑客?

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' 可用于将褪色颜色与背景颜色相匹配.此属性是绘制列表视图的颜色,并定义为 不透明颜色,因为您并不总是有白色背景(我认为这是默认颜色......但我不确定),最好的选择是使用Romain Guy 建议的透明颜色,#00000000".

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.

希望这就是您要找的!

干杯

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

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