Home > Software design >  Border in RecycleView Android
Border in RecycleView Android

Time:08-30

I'm using RecycleView, there shouldn't be a border after each item in the recycle view, but I have. How to remove it? I think the problem is in the LayoutManager because there is not border in the last element of RecycleView

<androidx.recyclerview.widget.RecyclerView
                android:background="@color/menu_background" //here is non border
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:clipToPadding="false"
                tools:listitem="@layout/cabin_category_info_layout" />

And it's CardView

<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp">

CodePudding user response:

If you use CardView you should know that there's a default corner on this View so if you don't want it you should configure it to don't show it.

Try adding this into your CardView

app:cardCornerRadius="0dp

Also if you want to remove the elevation you may use this too

app:cardElevation="0dp"

CodePudding user response:

The cardview by default has elevation which depicts as a border. You can either remove the card view or you can make the elevation as 0dp.

app:cardElevation="0dp"
  • Related