How to add rounded corner as background of Recyclerview in Android

I have a list. And I want to add a background, like a round corner to it. Thus, the list looks like a large map view. How can I implement this like Google Translate.

The rounded background can scroll through the list. So the shape.xml solution does not work here .

This is a screenshot of the translation.

+4
source share
1 answer

use this xml

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/color_white"/>

    <stroke android:width="3dp"
        android:color="@color/grey_ask"
        />

    <padding android:left="1dp"
        android:top="1dp"
        android:right="1dp"
        android:bottom="1dp"
        />

    <corners android:bottomRightRadius="7dp"
        android:bottomLeftRadius="7dp"
        android:topLeftRadius="7dp"
        android:topRightRadius="7dp"/>
</shape>

Increase radius radius values ​​for greater roundness. add this as a backgound to your recylerview

android:background="@drawable/nameofxml"
+8
source

All Articles