4

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

我一直在尝试使用填充父项,但它一直表现得像一个包装内容

<?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>

我在这里尝试了解决方案

如何让 Dialog 样式的活动窗口填满屏幕?

dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);

它做我想要的

所以现在我想知道我的 xml 中的内容(如果我能提供帮助,我会尝试将所有布局行为放在 xml 中而不是我的代码中 ^^)

4

2 回答 2

2

据我了解,如何让对话框样式的活动窗口填满屏幕?解决的是在加载 xml必须修改布局。基本上没有xml可以单独做到这一点。

于 2011-04-26T16:38:31.723 回答
2

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

于 2011-04-29T12:44:42.550 回答