如何创建对话框,长相酷似文本菜单? [英] How to create dialog that looks exactly like ContextMenu?

查看:115
本文介绍了如何创建对话框,长相酷似文本菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候它单曲使用非标准活性的方法,用于创建文本菜单不方便的(因为有可能是许多地方在一个活性,但在不同的类,其中,有必要以显示文本菜单)。

Sometimes it`s not convenient to use standart activity methods for creating ContextMenu (because there is can be many places in one activity but in different classes where it would be necessary to show contextmenu).

但创建对话框可以从任何地方方便。 如何创建对话框,长相酷似文本菜单?我在哪里可以找到非标准上下文菜单的布局或类似的东西?

But creating dialogs is easy from any place. How can I create dialog that looks exactly like ContextMenu? Where can I find layout of standart context menu or something like that?

推荐答案

我决定使用 AlertDialog s的列表(http://developer.android.com/guide /topics/ui/dialogs.html#AddingAList)代替文本菜单。它看起来像文本菜单(也许不完全的,因为不同的布局),但它更灵活,因为我可以处理不同的听众不同的动作。

I decide to use AlertDialogs with list (http://developer.android.com/guide/topics/ui/dialogs.html#AddingAList) instead of ContextMenu. It looks like ContextMenu (perhaps, not exactly, because of different layouts), but it's more flexible, cause I can handle different actions in different listeners.

这篇关于如何创建对话框,长相酷似文本菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆