对话框片段未在android中显示视图

对话框片段未在android中显示视图,android,android-fragments,android-constraintlayout,android-dialogfragment,android-dialog,Android,Android Fragments,Android Constraintlayout,Android Dialogfragment,Android Dialog,我使用androidx对话框片段来显示一些内容,但它没有显示对话框视图。 我的代码是 <androidx.cardview.widget.CardView android:id="@+id/content_root" android:layout_width="match_parent" android:layout_height="wrap_content"> <androidx.core.widget.Nes

我使用androidx对话框片段来显示一些内容,但它没有显示对话框视图。 我的代码是

<androidx.cardview.widget.CardView
        android:id="@+id/content_root"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <androidx.core.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/white">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingTop="@dimen/dp_10"
                android:paddingBottom="@dimen/dp_10">

                //my design
            </androidx.constraintlayout.widget.ConstraintLayout>
        </androidx.core.widget.NestedScrollView>
    </androidx.cardview.widget.CardView>

//我的设计

这是因为约束限制。这个问题可以通过将约束布局作为RelativeLayout的子项来解决

注意:如果将LinearLayout用作ConstraintLayout的父对象,则它将不起作用

#英国理工学院