Как закруглить углы CardView?

Если быть точнее, углы я закруглил, для этого я создал shape, но они не отображаются. Код разметки:

<?xml version="1.0" encoding="utf-8"?>
<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">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/titleLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:ignore="MissingConstraints">

        <ImageView
            android:id="@+id/logoImageView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="26dp"
            android:src="@drawable/vector"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/skipTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:alpha="0.5"
            android:fontFamily="sans-serif"
            android:padding="26dp"
            android:text="@string/string"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.viewpager2.widget.ViewPager2
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/titleLayout" />

    <LinearLayout
        android:id="@+id/progressIndicator"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_margin="30dp"
        android:orientation="horizontal"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/viewPager">

        <ImageView
            android:id="@+id/indicator1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="3dp"
            android:src="@drawable/indicator_inactive" />

        <ImageView
            android:id="@+id/indicator2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="3dp"
            android:src="@drawable/indicator_inactive" />

        <ImageView
            android:id="@+id/indicator3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="3dp"
            android:src="@drawable/indicator_inactive" />
    </LinearLayout>

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/nav_host_fragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:defaultNavHost="true"
        app:layout_constraintBottom_toTopOf="@+id/actionBar"
        app:navGraph="@navigation/nav_graph" />

    <androidx.cardview.widget.CardView
        android:id="@+id/actionBar"
        android:layout_width="match_parent"
        android:layout_height="64dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        android:background="@drawable/rounded_top_corners"
        app:cardElevation="4dp"
    app:cardCornerRadius="0dp">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/transparent"
            >

        <ImageButton
            android:id="@+id/homeBtn"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:background="@android:color/transparent"
            android:src="@drawable/home_icon"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="@id/searchBtn"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            />

        <ImageButton
            android:id="@+id/searchBtn"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:background="@android:color/transparent"
            android:src="@drawable/search_icon"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            />


        <ImageButton
            android:id="@+id/profileBtn"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:background="@android:color/transparent"
            android:src="@drawable/profile_icon"
            app:layout_constraintStart_toStartOf="@id/searchBtn"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            />

        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.cardview.widget.CardView>

</androidx.constraintlayout.widget.ConstraintLayout>

код эффекта:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF"/> <!-- Цвет фона -->
    <corners android:topLeftRadius="50dp" android:topRightRadius="20dp"/> <!-- Радиус закругления для верхних углов -->
</shape>

Если что закруглить нужно именно два верхних угла. Нижние не нужно.


Ответы (0 шт):