0

I have a list of Images into RecyclerView. I have to give Radius corner to these Images. How can I perform that? This the code of RecyclerView Container and Adapter:

RecyclerView list = (RecyclerView) view.findViewById(R.id.recycler_view_ricette_categorie_primi_top_10);
    list.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.HORIZONTAL,false));
    list.setAdapter(new HorizontalAdapter(new int[]{R.drawable.test_pizza,R.drawable.test_pizza,R.drawable.test_pizza,R.drawable.test_pizza,R.drawable.test_pizza,R.drawable.test_pizza}));

And this is the xml file of the Standard ImageView:

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="match_parent">


    <ImageView

        android:id="@+id/image_view_ricette_categorie_primi_top_10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="24sp"
        android:padding="16dp"
        android:layout_margin="8dp"
        android:src="@drawable/test_pizza"


        />

</LinearLayout>
Mtt95dvlpr
  • 145
  • 4
  • 12

1 Answers1

0

You can use this XML for the border shaping.

<?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>

Say the name of the file is border.xml

Then in your recycle view, refer the above xml as a background proerty.

android:background="@drawable/border"

You can increase the radius as per your needs.

Safeer Ansari
  • 772
  • 4
  • 13