Custom Dialog in full screen?(全屏自定义对话框?)
问题描述
有什么方法可以让我的对话框视图全屏显示,即对话框占据整个屏幕(如 Activity).我尝试使用 LayoutParams 和样式,例如<item name="android:windowFullscreen">true</item>
但似乎没有任何效果.
Is there any way to make my Dialog view full screen, i.e dialog occupy the entire screen (like an Activity). I tried using the LayoutParams and styles like
<item name="android:windowFullscreen">true</item>
but nothing seems to be working.
我找到了摆脱标题栏的方法,但找不到将对话框全屏显示的方法.所以有人可以建议我一种方法吗?
I found a way of getting rid of the Title bar, but couldn't find a way to put a dialog in full screen. So can any one suggest me a way to do it.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="@android:style/Theme.Dialog">
<item name="android:windowFullscreen">true</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@color/dialog_background</item>
</style>
</resources>
推荐答案
给它的构造函数一个非对话框的主题,例如 android.R.style.Theme 或 android.R.style.Theme_Light.
Give its constructor a non-dialog theme, such as android.R.style.Theme or android.R.style.Theme_Light.
@Bob 编写的代码.
Code by @Bob.
Dialog dialog = new Dialog(context, android.R.style.Theme_Light);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.MyCustomDialogLayout);
dialog.show();
这篇关于全屏自定义对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:全屏自定义对话框?


基础教程推荐
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01