java Android:如何将recyclerview滚动条置于recyclerview之上。物品装饰?
正如您在下图中注意到的,我的滚动条显示在项目分隔符/RecyclerView.ItemDecoration
后面。所以你可以看到滚动条上的分隔符,看起来很难看。有没有办法把滚动条放在前面
你可以在下面搜索框中键入要查询的问题!
正如您在下图中注意到的,我的滚动条显示在项目分隔符/RecyclerView.ItemDecoration
后面。所以你可以看到滚动条上的分隔符,看起来很难看。有没有办法把滚动条放在前面
# 1 楼答案
我想滚动条已经在分隔符前面了,它是半透明的,所以你的分隔符可以显示出来
您可以通过
android:scrollbarStyle
属性控制滚动条定位此属性有四个可能的值:
insideOverlay
、insideInset
、outsideOverlay
、outsideInset
,记录在此处:http://developer.android.com/reference/android/view/View.html#attr_android:scrollbarStyle
解决方案#1: 使用
outsideOverlay
或outsideInset
将滚动条放置在内容之外,从而避免重叠。这里的@ScottStanchfield答案提供了有关以下内容的有用信息:android ListView scrollbarStyle解决方案#2: 另一个可能的解决方案是将
ItemDecoration
分隔符修改为在边缘附近逐渐消失的渐变,避免与滚动条重叠按如下方式定义
divider.xml
:修改插图和颜色以满足您的需要。插图将防止与滚动条重叠,渐变允许分割线向左右边缘淡出
解决方案#3: 通过属性
android:scrollbarThumbVertical
为滚动条使用自定义可绘制文件,并确保此可绘制文件是不透明的