android:layout:如何让我的对话框用XML填充屏幕

android:layout:如何让我的对话框用XML填充屏幕,android,layout,fill-parent,Android,Layout,Fill Parent,我试图打开一个对话框来覆盖大部分屏幕(我的意思是它仍然有很好的圆角效果,但覆盖了后面的内容) 我一直在尝试使用fill parent,但它一直表现得像一个包装内容 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" andr

我试图打开一个对话框来覆盖大部分屏幕(我的意思是它仍然有很好的圆角效果,但覆盖了后面的内容)

我一直在尝试使用fill parent,但它一直表现得像一个包装内容

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:layout_centerHorizontal="true"
 >


<LinearLayout
    android:gravity="center_horizontal"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <SurfaceView android:id="@+id/surface"
        android:layout_width="400px"
        android:layout_height="200px"
        android:layout_centerHorizontal="true">
    </SurfaceView>
    <Button android:id="@+id/Button01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:text="Ok, Let me play !!!" />
</LinearLayout>
</LinearLayout>
这就是我想要的


因此,现在我想知道我的xml中有什么内容(如果我可以帮助的话,我尝试将所有布局行为放在xml中,而不是放在我的代码中^^)

据我所知,要解决的问题是,在加载xml后必须修改布局。基本上没有xml可以单独完成这项工作。

将透明(glass.png)图像设置为xml的父线性布局的背景。 该对话框将覆盖90%的屏幕。
您可以通过在google images中搜索找到所需的image glass.png。

嘿,您能帮我让它拉伸并填充整个屏幕,而不仅仅是png文件的像素大小吗?
dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);