androidxmlandroid-layoutandroid-recyclerviewandroid-cardview

how can I remove the recyclerview swapping indicator or at least change it's color to white so user won't see it?


I have created 3 recyclerview and each of them swap horixontally from right to left and left to right but while swapping, it shows a Grey colour indicator below the cardviews for sometime when I start swapping and then they go away when the cardview stops moving and if I swap again, it reappears. This is the Grey colour indicator that i am talking about below the cardview.enter image description here

below is my xml code

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:background="@drawable/flash_tablebar"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        android:layout_alignParentTop="true">

        <ImageView
            android:id="@+id/back_icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:src="@drawable/ic_arrow_back" />

        <RelativeLayout
            android:layout_marginLeft="20dp"
            android:id="@+id/relativeFlashcard"
            android:layout_width="wrap_content"
            android:layout_height="100dp"
            android:layout_toRightOf="@id/back_icon">
            <TextView
                android:id="@+id/title_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_marginStart="30dp"
                android:text="Flashcards"
                android:textSize="40sp"
                android:textColor="#FFF" />
            <TextView
                android:id="@+id/subtext_flash"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textStyle="bold"
                android:layout_below="@id/title_text"
                android:layout_marginStart="30dp"
                android:text="@string/swipe_left_for_more_cards"
                android:textSize="20sp"
                android:textColor="#FFF" />
        </RelativeLayout>
    </androidx.appcompat.widget.Toolbar>
    <LinearLayout
        android:gravity="center_horizontal"
        android:layout_marginTop="5dp"
        android:id="@+id/linearH1"
        android:orientation="horizontal"
        android:layout_marginStart="10dp"
        android:layout_width="match_parent"
        android:layout_below="@id/toolbar"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textEasy"
            android:gravity="start"
            android:textStyle="bold"
            android:textSize="20sp"
            android:layout_marginTop="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/easy_cards"/>

        <ImageView
            android:layout_marginTop="11dp"
            android:layout_marginStart="10dp"
            android:layout_width="16dp"
            android:layout_height="16dp"
            android:src="@drawable/arrow" />

    </LinearLayout>
    <LinearLayout
        android:layout_below="@id/linearH1"
        android:layout_width="match_parent"
        android:id="@+id/linear1"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="5dp">
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerViewFlashcardsEasy"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="5dp"
            android:layout_marginEnd="5dp"
            android:layout_marginTop="15dp"
            android:scrollbars="horizontal">
        </androidx.recyclerview.widget.RecyclerView>
    </LinearLayout>
    <LinearLayout
        android:layout_marginTop="5dp"
        android:id="@+id/linearH2"
        android:orientation="horizontal"
        android:gravity="center_horizontal"
        android:layout_marginStart="10dp"
        android:layout_width="match_parent"
        android:layout_below="@id/linear1"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textMedium"
            android:gravity="start"
            android:textStyle="bold"
            android:textSize="20sp"
            android:layout_marginTop="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/medium_cards"/>

        <ImageView
            android:layout_marginTop="11dp"
            android:layout_marginStart="10dp"
            android:layout_width="16dp"
            android:layout_height="16dp"
            android:src="@drawable/arrow" />

    </LinearLayout>
    <LinearLayout
        android:layout_below="@id/linearH2"
        android:id="@+id/linear2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="5dp">
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerViewFlashcardsMedium"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="5dp"
            android:layout_marginEnd="5dp"
            android:layout_marginTop="15dp"
            android:scrollbars="horizontal">
        </androidx.recyclerview.widget.RecyclerView>
    </LinearLayout>

    <LinearLayout
        android:layout_marginTop="5dp"
        android:id="@+id/linearH3"
        android:orientation="horizontal"
        android:gravity="center_horizontal"
        android:layout_marginStart="10dp"
        android:layout_width="match_parent"
        android:layout_below="@id/linear2"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/textHard"
            android:gravity="start"
            android:textStyle="bold"
            android:textSize="20sp"
            android:layout_marginTop="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/medium_cards"/>

        <ImageView
            android:layout_marginTop="11dp"
            android:layout_marginStart="10dp"
            android:layout_width="16dp"
            android:layout_height="16dp"
            android:src="@drawable/arrow" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/linear3"
        android:layout_below="@id/linearH3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="5dp">
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerViewFlashcardsHard"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="5dp"
            android:layout_marginEnd="5dp"
            android:layout_marginTop="15dp"
            android:scrollbars="horizontal">
        </androidx.recyclerview.widget.RecyclerView>
    </LinearLayout>
</RelativeLayout>

Solution

  • Set the scrollbars attribute to none instead of horizontal, inside your RecyclerView

     android:scrollbars="none"