安卓自定义选项菜单项[英] Android custom option menu item

本文是小编为大家收集整理的关于安卓自定义选项菜单项的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

每个人!我有疑问是Android家伙.任何帮助或建议都将得到欣赏.

所以我的问题:

我有actionbarcompat应用程序,在此动作栏中,我有很多不同的hiden菜单项,只有在用户点击动作栏的菜单按钮时才出现.此外,我在动作栏上有耦合菜单项,总是可见.

我需要一些可观的菜单项的自定义.当用户单击此菜单项(假设它是"添加新的"菜单项)时,我需要在这种情况下显示不同的菜单.如果用户单击Standart菜单项,它应该像通常一样行动.

所以我真的很困惑.而且我不知道我如何做到.也许有人有同样的问题或类似.谢谢!

屏幕截图更好地理解:

推荐答案

您可以通过几个不同的提供商通过以下方式,如下所示

Android developer
vogella
androidhive

所有这些都有很好的例子和源代码,以帮助您出去

本文地址:https://www.itbaoku.cn/post/102535.html

问题描述

everyone! I have question for Android guys. Any help or suggestion will be appreciated.

So my problem:

I have application with ActionBarCompat and in this action bar I have a lot of different hiden menu items, which appear only if user click on menu button at action bar. Also I have couple menu items at action bar, which always visible.

I need some customization for one of visible menu item. When user click on this menu item (let's say it would be "Add new" menu item), I need to show different menu in this case. And if user click on standart menu item, it should act like usually.

So I really confused. And I have no idea how I can do it. Maybe someone had the same problem or similar. Thank you!

Screenshot for better understanding:

推荐答案

You can go through the tutorial from several different providers as follows which are recommended by SO

Android Developer
Vogella
AndroidHive

All of them have great examples and source code to help you out