android - 具有褪色边缘的水平回收 View

标签 android android-recyclerview

如果我查看 stackoverflow 应用程序的水平 recyclerview,我可以看到他们使用了“淡化边缘”技术,以便用户知道 recyclerview 的左侧和右侧有项目并且他/她可以滚动。

stackoverflow

在 ListView 中,我认为这种效果是通过调用 Romain Guy (http://www.curious-creature.com/category/android/page/2/) 所描述的以下方法来启用的:

android:cacheColorHint="#00000000"

不幸的是,Recyclerview 中不存在这样的选项。是否有内置方法允许 recyclerview 的这些褪色边缘,或者它是否必须是 hack?

最佳答案

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

android:requiresFadingEdge="horizontal|vertical"

您可以从回收站 View 的 documentation 中搜索并更好地理解此属性.

您正在谈论的另一个属性 'cacheColorHint' 可用于将褪色颜色与背景颜色相匹配。此属性是绘制 ListView 的颜色,定义为 opaque color。 ,因为你并不总是有白色背景(我认为这是默认颜色......但我不确定),最好的选择是使用透明颜色“#00000000”,正如 Romain Guy 所建议的.

希望这就是您要找的!

干杯

关于android - 具有褪色边缘的水平回收 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33720836/

相关文章:

java - 位图文件夹到可绘制的 int 数组,以便在 RecyclerView 中显示

java - 将特定项目设置为始终位于 recyclerview 顶部

android - RecyclerView - 当 View 不再可见时回调

android - 单击任何按钮刷新选项卡布局中的 fragment

android - Android 应用程序的 "Feature Graphic"是什么?

Android 的主页对话框

android - 在 Retrofit - Android 中使用 addConverterFactory 处理 Json 和 XML 响应

android - 从 Intent 启动 Instrumentation 测试

Android StaggeredGridLayoutManager 偏移错误

c# - Xamarin Android 应用程序在 Release模式下崩溃(Parse.Android SDK)