简体   繁体   English

有没有一种方法可以显示Android对话框而不会使背景变灰?

[英]Is there a way to show an Android dialog without graying out the back drop?

I want to pop open a DatePickerDialog in a certain screen, but I am required to not grey out the rest of the screen (the view behind the dialog) when the DatePickerDialog window opens. 我想在某个屏幕上弹出一个DatePickerDialog,但是当DatePickerDialog窗口打开时,我不应该将其余屏幕(对话框后面的视图)显示为灰色。 Is there a way to achieve this? 有没有办法做到这一点?

You probably would want to create your own custom dialog. 您可能想要创建自己的自定义对话框。 You can extend DialogFramgent and change it accordingly. 您可以扩展DialogFramgent并进行相应的更改。

See the Android doc HERE for a great example. 看到Android的文档这里的一个很好的例子。

Or, use PopupWindow if you want a popover dialog with control of the background, see this SO post . 或者,如果您想要一个带有背景控制的弹出对话框,请使用PopupWindow ,请参见此SO post

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM