Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot remove scrollbar from gridview

I have read and tried all of the stackoverflow questions about removing/hiding a scrollbar from a gridview, however, it wont disappear! I am testing on a Samsung Galaxy S4 running Lollipop.

Here is my XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/llChooserContainer"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scrollbars="none"
    android:layout_marginTop="?android:attr/actionBarSize"
    android:orientation="vertical">

    <GridView
        android:id="@+id/gvGallery"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_margin="10dp"
        android:columnWidth="@dimen/chooser_grid_col_width"
        android:fadingEdgeLength="10dp"
        android:fastScrollEnabled="true"
        android:scrollbars="none"
        android:gravity="center"
        android:numColumns="auto_fit"
        android:requiresFadingEdge="vertical"
        android:scrollingCache="true"
        android:stretchMode="columnWidth"/>

</LinearLayout>

Here is my onCreate

    llChooserContainer.setVerticalScrollBarEnabled(false);
    llChooserContainer.setHorizontalScrollBarEnabled(false);
    gvGallery.setOnItemClickListener(this);
    gvGallery.setVerticalScrollBarEnabled(false);
    gvGallery.setHorizontalScrollBarEnabled(false);
    gvGallery.setAdapter(imagesAdapter);

Also tried setting styles like

    gvGallery.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);

and setting size to null:

    gvGallery.setScrollBarSize(0);

and thumb to null

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

There is nothing in the XML -> styles.xml I also tried cleaning the project, invalidating caches, uninstalling the app every time.

enter image description here

like image 284
Kaloyan Roussev Avatar asked Jul 25 '26 10:07

Kaloyan Roussev


2 Answers

you can try this

    android:fadeScrollbars="false"

or

    android:scrollbarThumbVertical="@android:color/transparent"
like image 52
Arjun saini Avatar answered Jul 27 '26 23:07

Arjun saini


try this, remove the below property from gridview:

android:fastScrollEnabled="true"
like image 41
Pradeep Gupta Avatar answered Jul 27 '26 22:07

Pradeep Gupta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!