0

我有一个Framelayout带有圆角作为框架布局背景的代码

  <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>

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

我已将其替换为<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>

问题是我的 scandiff 工具显示对话框变宽了。用xml替换代码怎么会导致这个?

4

0 回答 0