Kaloyan Roussev
Kaloyan Roussev

Reputation: 14711

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

Upvotes: 2

Views: 4232

Answers (2)

Pradeep Gupta
Pradeep Gupta

Reputation: 1770

try this, remove the below property from gridview:

android:fastScrollEnabled="true"

Upvotes: 3

Arjun saini
Arjun saini

Reputation: 4182

you can try this

    android:fadeScrollbars="false"

or

    android:scrollbarThumbVertical="@android:color/transparent"

Upvotes: 7

Related Questions