NestedScrollView 滾動條自定義樣式及padding設置無效的bug解決

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佈局是不生效的

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章