有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (1) 个答案

  1. # 1 楼答案

    我想滚动条已经在分隔符前面了,它是半透明的,所以你的分隔符可以显示出来

    您可以通过android:scrollbarStyle属性控制滚动条定位

    此属性有四个可能的值:insideOverlayinsideInsetoutsideOverlayoutsideInset,记录在此处:

    http://developer.android.com/reference/android/view/View.html#attr_android:scrollbarStyle

    解决方案#1: 使用outsideOverlayoutsideInset将滚动条放置在内容之外,从而避免重叠。这里的@ScottStanchfield答案提供了有关以下内容的有用信息:android ListView scrollbarStyle

    解决方案#2: 另一个可能的解决方案是将ItemDecoration分隔符修改为在边缘附近逐渐消失的渐变,避免与滚动条重叠

    按如下方式定义divider.xml

    <inset xmlns:android="https://schemas.android.com/apk/res/android"
        android:insetLeft="16dp" android:insetRight="16dp">
        <shape android:shape="rectangle">
            <gradient android:startColor="#20FF0000" android:centerColor="#FFFF0000" android:endColor="#20FF0000" android:angle="0" />
        </shape>
    </inset>
    

    修改插图和颜色以满足您的需要。插图将防止与滚动条重叠,渐变允许分割线向左右边缘淡出

    解决方案#3: 通过属性android:scrollbarThumbVertical为滚动条使用自定义可绘制文件,并确保此可绘制文件是不透明的