Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 我的对话框现在填充整个高度,而不是环绕内容_Android_Xml - Fatal编程技术网

Android 我的对话框现在填充整个高度,而不是环绕内容

Android 我的对话框现在填充整个高度,而不是环绕内容,android,xml,Android,Xml,我试图使用一个对话框窗口,人们可以在其中填写一些信息。但我遇到了一个问题,它在高度(而不是宽度)上填满了我的整个屏幕。 这是我的布局文件: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/t

我试图使用一个对话框窗口,人们可以在其中填写一些信息。但我遇到了一个问题,它在高度(而不是宽度)上填满了我的整个屏幕。

这是我的布局文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/dialog_bg"
    tools:context=".UI.Main.Create.CreateStoryDialogFragment">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        //some fields

    </LinearLayout>
</RelativeLayout>

有人可能会说我哪里出了问题吗?

使用
android:layout\u height=“wrap\u content”
如果您想按内容包装视图,那么如果您在布局XML中替换所有
android:layout\u height=“match\u parent”
,它应该可以工作


您可能需要使用
FrameLayout
替换
RelativeLayout

尝试将linearlayout中的android:layout\u height=“match\u parent”更改为android:layout\u height=“wrap\u content”。如果能成功的话。
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));