0

I had a Framelayout with code that makes rounded corners as the framelayout background

  <FrameLayout
      android:id="@+id/popover"
      style="@style/popover_style"
      android:layout_width="@dimen/popover_width"
      android:layout_height="0dp"
      android:layout_marginBottom="@dimen/popover_bottom_margin"
      android:layout_marginLeft="@dimen/popover_side_margin"
      android:layout_marginRight="@dimen/popover_side_margin"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintHeight_default="wrap"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="@+id/popover_top_guideline"
      app:layout_constraintVertical_bias="0">
  </FrameLayout>

and

    ShapeAppearanceModel shapeAppearanceModel = new ShapeAppearanceModel();
    shapeAppearanceModel.setAllCorners(
        CornerFamily.ROUNDED,
        context.getResources().getDimensionPixelSize(R.dimen.corner_radius));
    ViewCompat.setBackground(
        popover, getPopoverViewShapeDrawable(getContext(), shapeAppearanceModel));

and I have replaced it with a <androidx.cardview.widget.CardView>

 <androidx.cardview.widget.CardView
      android:id="@+id/popover"
//same..      
style="@style/popover_style"card_view:cardCornerRadius="@dimen/popup_corner_radius">
  </androidx.cardview.widget.CardView>

The problem is that my scandiff tool shows the dialog became wider. How can replacing the code with xml cause this?

Elad Benda
  • 35,076
  • 87
  • 265
  • 471

0 Answers0