I have created a cardview inside a recyclerview that is using a Relativelayout as a containter.
This is the xml code for the mainactivity
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
android:background="@drawable/gradient_background"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/activity_rounded_bg"
android:layout_marginTop="50dp">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="67dp"
android:paddingTop="10dp"
android:paddingHorizontal="0dp"
android:clipToPadding="true"
tools:listitem="@layout/cardview_contact_item">
</androidx.recyclerview.widget.RecyclerView>
</RelativeLayout>
<ImageButton
android:id="@+id/btnAddContact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00FFFFFF"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="@drawable/ic_add_icon" />
</androidx.constraintlayout.widget.ConstraintLayout>
I wanted to ask how can I use the Relativelayouts rounded rectangle background as a clipping mask for the recycler view, so that it cuts off on the either side