Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.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_Android Dialog - Fatal编程技术网

Android 全屏显示对话框

Android 全屏显示对话框,android,android-dialog,Android,Android Dialog,我的问题是我不想全屏显示透明对话框 下面是我使用的代码 dialog = new Dialog(this, R.style.CustomDialogTheme); dialog.setContentView(R.layout.enterjoinseecode_dialog); 自定义对话框主题 <style name="CustomDialogTheme" parent="@android:style/Theme.Translucent.NoTitleBar">

我的问题是我不想全屏显示透明对话框 下面是我使用的代码

 dialog = new Dialog(this, R.style.CustomDialogTheme);
    dialog.setContentView(R.layout.enterjoinseecode_dialog);
自定义对话框主题

  <style name="CustomDialogTheme" parent="@android:style/Theme.Translucent.NoTitleBar">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowFullscreen">false</item>
</style>

真的
@空的
真的
假的

请有人帮我找出错误所在

试试这个。为
对话框
创建视图,如下所示

 <RelativeLayout
    android:layout_width="450dp"
    android:layout_height="250dp"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:orientation="vertical" >

// Here you can add your component.

</RelativeLayout>

就是这样。希望这能对您有所帮助。

创建一个具有透明背景的活动,并为该活动定义如下主题

<activity android:theme="@android:style/Theme.Dialog" />

将其从最近的应用程序列表中删除。

通过以下步骤,可以在不显示全屏的情况下获得透明效果的对话框

不需要定义样式“CustomDialogTheme”,需要将构造函数的主题参数传递为android.R.style.theme\u transparent\u NoTitleBar

而在膨胀的xml中,只使用后台作为android:background=“#29000000”使其透明效果,并使用布局属性定位对话框


如果我以某种方式使用上述样式CustomDialogTheme,它将显示为窗口而不是对话框,因为我应用了直接主题以显示为对话框(不是全屏)为了使其在xml中具有透明效果,我设置了属性背景

您是否可以发布运行代码所得到的
错误或不想要的行为
。不在活动中如果您使用此选项,则您的活动将像一个对话框。试试看。它将与dialog完全相同。谢谢您的评论。但不想在单独的活动中添加与对话相关的所有事件。您能告诉我您有哪些不愿意移动的对话事件吗?
<activity android:theme="@android:style/Theme.Dialog" />
android:excludeFromRecents="true"