Android ScrollView Scrollbar Size

后端 未结 3 2142
失恋的感觉
失恋的感觉 2021-02-20 09:55

I\'m using a ScrollView and I want to set the ScrollBar size, but everything I tried failed. I tried with attribute android:scrollbarSize, with style, with the theme but nothing

相关标签:
3条回答
  • 2021-02-20 10:01

    Try implementing android:scrollbarThumbVertical and android:scrollbarSize="1dp" together, and your problem will be solved for ScrollView, RecyclerView.

    Refer following code snippet

    <ScrollView 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"
        android:layout_marginTop="10px"
        android:layout_marginBottom="15px"
        android:scrollbars="vertical"
        android:scrollbarThumbVertical="@color/colorPrimaryDark"
        android:scrollbarSize="1dp">
    

    For HorizontalScrollView:

    <HorizontalScrollView
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"
        android:layout_marginTop="10px"
        android:layout_marginBottom="15px"
        android:scrollbars="horizontal"
        android:scrollbarThumbHorizontal="@color/colorPrimaryDark"
        android:scrollbarSize="1dp">
    
    0 讨论(0)
  • 2021-02-20 10:12

    I've actually been struggling with this as well. Unfortunately, it appears that the problem is actually in the Android sourcecode, and will not be fixed until the next Android release. After a bit of searching, I found this info here: http://code.google.com/p/android/issues/detail?id=14317.

    0 讨论(0)
  • 2021-02-20 10:25

    Have you tried to change the scrollbar drawable to some bigger one?

    android:scrollbarThumbHorizontal

    0 讨论(0)
提交回复
热议问题