android - 打开带有对话框的选项菜单

标签 android menu dialog

这似乎是一个非常简单的问题,但我不确定它是否可行。当对话框显示在顶部时,是否可以允许 MENU 按钮仍然调出选项的菜单?我想这样做是因为我想在打开对话框时为用户提供更多选项。

最佳答案

我认为这是不可能的。

虽然文档说你应该能够做到这一点。

A dialog is always created and displayed as a part of an Activity. You should normally create dialogs from within your Activity's onCreateDialog(int) callback method. When you use this callback, the Android system automatically manages the state of each dialog and hooks them to the Activity, effectively making it the "owner" of each dialog. As such, each dialog inherits certain properties from the Activity. For example, when a dialog is open, the Menu key reveals the options menu defined for the Activity and the volume keys modify the audio stream used by the Activity.

http://developer.android.com/guide/topics/ui/dialogs.html

关于android - 打开带有对话框的选项菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6802607/

相关文章:

android - 使用键盘打开 fragment

html - 带有垂直子/下拉菜单的水平 CSS 菜单。请帮助

php - WordPress:显示父菜单标题

javafx.scene.control.Dialog<R> 不会在按下 "x"时关闭

Android - 在 translationY() 动画上更新 View 的高度

android - Android 目标设备不兼容?

Android:基于速度的 ViewPager 滚动

c - menu.h && form.h 在 pdcurses 中不存在

dialog - Angular6 Material Dialog 在按回车键时阻止关闭

java - Android 在右下角显示警报对话框,并在显示时使用 Activity