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

问题描述 投票:-1回答:1

我正在使用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>
android android-fragments android-constraintlayout android-dialogfragment android-dialog
1个回答
-1
投票
这是因为ConstraintLayout。可以通过将约束布局作为RelativeLayout的子级来解决此问题。
© www.soinside.com 2019 - 2024. All rights reserved.