Corner radius of CardView nested in ViewPager2 not shows

22 Views Asked by At

I has ViewPager2 in my app:

<androidx.viewpager2.widget.ViewPager2
        android:id="@+id/cardsViewPager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/normalMargin"
        app:layout_constraintTop_toBottomOf="@id/inputBox"/>

That ViewPager2 contains list of fragments with next xml:

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/mainContainer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="@dimen/minCardHeight"
    android:layout_margin="@dimen/normalMargin"
    app:cardCornerRadius="16dp"
    app:cardElevation="@dimen/cardview_default_elevation"
    app:cardBackgroundColor="#CFD6D8">
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        tools:listitem="@layout/recycler_item"/>
</androidx.cardview.widget.CardView>

But cardCornerRadius of CardView in fragment is not working

enter image description here

0

There are 0 best solutions below