【问题标题】:Is it possible to launch an Android Activity from an AlertDialog?是否可以从 AlertDialog 启动 Android Activity?
【发布时间】:2025-12-16 19:45:03
【问题描述】:

我正在尝试在我的 Android 应用程序中创建一个小弹出窗口,让用户从众多项目中进行选择,例如 ListView。我希望让它显示为一个覆盖在屏幕上的半透明框,而不是像活动通常那样完全占据它。

我听说的一种方法是在 AlertDialog 框中启动一个 Activity。这将是完美的 - 它是理想的尺寸并且具有我正在寻找的许多机械性能,但我完全无法找到该技术的更多细节。

这可能吗?如果没有,完成这样的事情的首选方法是什么?

【问题讨论】:

    标签: android listview android-activity


    【解决方案1】:

    这应该回答你的问题:http://developer.android.com/guide/topics/ui/themes.html

    Quote: 例如,您可以使用Dialog 主题来使您的Activity 看起来像一个对话框。在清单中,引用一个 Android 主题,如下所示:

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

    【讨论】:

      【解决方案2】:

      也许你可以只显示 AlertDialog http://developer.android.com/guide/topics/ui/dialogs.html

      【讨论】:

        最近更新 更多