与Android的图标文本菜单选项 [英] Android ContextMenu option with icon

查看:117
本文介绍了与Android的图标文本菜单选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我有一个简单的问题 - 这是可能与上下文菜单中的图标添加菜单项?我搜索这个问题,所有我发现的是,这是不可能的,但是当我执行长单击添加到主上下文菜单被显示在Android设备的主屏幕,包含文本菜单项和图标,所以我也一定是这样做的一种方式。

I have a simple question - It is possible to add a menu item with an icon to a context menu ? I've searched this issue and all I found is that it is not possible, but in the Home screen of the Android device when I perform long-click a "add to home" context menu is being displayed, contains menu items with text and icon, so I figured there got to be a way of doing it.

我尝试使用 MenuItem.setIcon()的方法,但图标没有在上下文菜单disaplyed,只有文字。

I tried using the MenuItem.setIcon() method but the icon is not disaplyed in the context menu, only the text.

谢谢!

推荐答案

无论你在哪里看到的图标,这不是一个上下文菜单。如果感觉有点像一个上下文菜单,但有图标,这可能是一个 AlertDialog 使用自定义的 ListAdapter 使用行带图标。

Wherever you see icons, that's not a context menu. If it feels a bit like a context menu but has icons, that's probably an AlertDialog with a custom ListAdapter that uses rows with icons.

这篇关于与Android的图标文本菜单选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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