-1

I'm using a CardView layout for a PopupWindow view. I want the layout to have rounded corners and it works, the problem is that the rest of the corners are shown (where the cut of the rounding is made):

enter image description here

I want to remove the black corners and have only the rounded ones, I did this before but for some reason I can't manage to remove in this case. I tried:

card_view:cardPreventCornerOverlap="false"
card_view:cardUseCompatPadding="true"

But it didn't work. I also tried to set the layout background to transparent, but also no luck.

this is the code:


<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    xmlns:card_view="http://schemas.android.com/tools"
    app:cardCornerRadius="8dp"
    card_view:cardPreventCornerOverlap="false"
    card_view:cardUseCompatPadding="true">

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

        <ImageButton
            android:id="@+id/delete"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="8dp"
            android:background="@android:color/transparent"
            android:src="@drawable/ic_delete"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/share"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageButton
            android:id="@+id/share"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="8dp"
            android:background="@android:color/transparent"
            android:src="@drawable/ic_share"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/delete"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
Geeky bean
  • 475
  • 6
  • 21

1 Answers1

0

With the help of @ADM, the problem was in the popup window setup, and not the layout itself.

So, adding the following line to the popup initialization fixed the issue:

popup.setBackgroundDrawable(ColorDrawable(android.graphics.Color.TRANSPARENT))
Geeky bean
  • 475
  • 6
  • 21