美文网首页程序人生
NestedScrollView 滚动条自定义样式及paddin

NestedScrollView 滚动条自定义样式及paddin

作者: 为自己代颜_ | 来源:发表于2021-05-17 13:16 被阅读0次

1.layout中布局

 <androidx.core.widget.NestedScrollView
            android:id="@+id/nestedscrollview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fadeScrollbars="true"
            android:scrollbars="vertical"
            android:scrollbarThumbVertical="@drawable/nest_scroll_view_style">
.
.
.
 </androidx.core.widget.NestedScrollView>
  1. drawable文件夹下的布局
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:width="8px"
        android:right="8px"
        android:top="140px">
        <shape>
            <!--此处指定高度不起作用-->
            <corners android:radius="3px"></corners>
            <solid android:color="@color/font_99" />
        </shape>
    </item>
</layer-list>

关键点分析:
必须使用layer-list 单纯的使用shape布局是不生效的

相关文章

网友评论

    本文标题:NestedScrollView 滚动条自定义样式及paddin

    本文链接:https://www.haomeiwen.com/subject/saljjltx.html