Search code examples
javaandroidkotlinlistviewandroid-recyclerview

Items go over the rounded recyclerview


I created a recycler view and I added a rounded rectangle with 2dp stroke to it as a background, but when items go in and out of the frame the go over the rounded corner

I tried adding paddings and margins but nothing happened.


Solution

  • you should try using MaterialCardView for this issue, because it is very helpfull for this type of issue, like below:

    <com.google.android.material.card.MaterialCardView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:cardCornerRadius="2dp"
        app:cardBackgroundColor="@color/white"
        app:cardElevation="0dp" >
    
        //Place your recyclerview here with matchparent
    
    </com.google.android.material.card.MaterialCardView>