Recycler View custom beautiful layout xml code for android studio

 Recycler View custom beautiful layout xml code for android studio -

 layout_item.xml code -

<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EFEFEF"
android:orientation="vertical">

<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="111dp"
android:layout_margin="11dp"
android:layout_marginTop="7dp"
app:cardCornerRadius="11dp">

<LinearLayout
android:id="@+id/linear_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="11dp"
android:background="#9AFFF6"
android:orientation="vertical">

<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:layout_marginTop="5dp"
android:gravity="center"
android:padding="11dp"
android:text="item"
android:textColor="#FF0202"
android:textSize="18sp"
android:textStyle="bold" />

</LinearLayout>
</androidx.cardview.widget.CardView>

</LinearLayout>

Create a corner radius item layout -

Step 1- Create a drawable recourse  layout item.xml 
write this code
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android1="http://schemas.android.com/apk/res/android"
android1:shape="rectangle">
<solid android1:color="#000000" />
<corners android1:radius="10dp" />
<stroke android1:color="@color/white"
android1:width="2dp" >
</stroke>



</shape>




Post a Comment

Previous Post Next Post