由网友(╰留个小板寸回忆小童年)分享简介:我有一个文本菜单列表视图,但是当我操作SetIcon的文本菜单看起来这是行不通的。公共无效onCreateContextMenu(文本菜单菜单,视图V,ContextMenuInfo menuInfo){super.onCreateContextMenu(菜单,V,menuInfo);menu.add(0,DELETE...![在Android studio上自定义精美界面,要求包含选项菜单 上下文菜单及其对应的监听事件 高级UI组件使用练习 附完整源码](https://p.xsw88.cn/allimgs/daicuo/20230906/317.png)
我有一个文本菜单列表视图,但是当我操作SetIcon的文本菜单看起来这是行不通的。
公共无效onCreateContextMenu(文本菜单菜单,视图V,
ContextMenuInfo menuInfo){
super.onCreateContextMenu(菜单,V,menuInfo);
menu.add(0,DELETE_ID,0,R.string.context_menu_favorite)
.setIcon(android.R.drawable.btn_star);
}
解决方案
上下文菜单不支持图标。
注:上下文菜单项不 支持图标或快捷键。
I have a Listview with a ContextMenu, but when I setIcon for ContextMenu look like it doesn't work
public void onCreateContextMenu(ContextMenu menu , View v,
ContextMenuInfo menuInfo){
super.onCreateContextMenu(menu, v, menuInfo);
menu.add(0, DELETE_ID, 0, R.string.context_menu_favorite)
.setIcon(android.R.drawable.btn_star);
}
![在Android studio上自定义精美界面,要求包含选项菜单 上下文菜单及其对应的监听事件 高级UI组件使用练习 附完整源码](https://p.xsw88.cn/allimgs/daicuo/20230906/317.png)
解决方案
Context menus do not support icons.
Note: Context menu items do not support icons or shortcut keys.
相关推荐
最新文章