Hide scrollbar in ScrollView

后端 未结 11 1526
时光说笑
时光说笑 2020-12-14 05:19

I have an app with a ScrollView, and I don\'t want the scrollbar to appear on the screen. How can I hide the scrollbar in a ScrollView while making sure scrolling still work

相关标签:
11条回答
  • 2020-12-14 05:51

    This will hide the Scroll bar stick but scroll bar is not disable

    android:scrollbarThumbVertical="@null"
    
    android:scrollbarThumbHorizontal="@null"
    

    This will disable the scroll bar

    android:scrollbars="none"
    
    0 讨论(0)
  • 2020-12-14 05:51

    you have to try the following solutions

        android:scrollbars="none"
    

    OR

        android:scrollbarThumbVertical="@null"
        android:scrollbarThumbHorizontal="@null"
    

    OR Change color of scrollBars to hide them

        android:scrollbarThumbVertical="@android:color/transparent"
    
    0 讨论(0)
  • 2020-12-14 05:57

    In Java add this code

    myScrollView.setVerticalScrollBarEnabled(false);
    myScrollView.setHorizontalScrollBarEnabled(false);
    

    In XML add following attribute to your ScrollView

    android:scrollbars="none"
    

    Like this

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/mainScroll"
    android:scrollbars="none" <!-- line to be added -->
    >
    
    0 讨论(0)
  • 2020-12-14 05:57

    If you are making "custom" HorizontalScrollView then you should set those properties in code like so

    this.scrollBarSize = 0 this.isHorizontalScrollBarEnabled = false

    That is the only way I got mine to work.

    0 讨论(0)
  • 2020-12-14 05:58

    In the XML layout, add this property:

    android:scrollbarSize="0dp"
    
    0 讨论(0)
  • 2020-12-14 06:01

    Try this, it is also working...

    android:scrollbarThumbVertical="@null"
    

    or

    android:scrollbarThumbHorizontal="@null"
    
    0 讨论(0)
提交回复
热议问题