【问题标题】:Dialog fragment is not showing a view in android对话框片段未在 android 中显示视图
【发布时间】:2019-11-21 06:04:53
【问题描述】:

我正在使用 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】:

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

    注意:如果您使用 LinearLayout 作为 ConstraintLayout 的父级,那么它将不起作用。

    #bst

    【讨论】:

      猜你喜欢
      • 2015-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多