如何实现自定义下拉菜单中的机器人到动作条 [英] How to implement custom drop-down menu to actionbar in android
问题描述
我想实现的动作条下拉菜单中,(项目数可以很在运行时)。对于例如:谷歌地图有一个。
i am trying to implement drop down menus in in actionbar, ( the count of items may very in runtime). for eg: Google map has the one.
如何在Android中实现它。这里怎么菜单我在找。也就是说,如果我点击R图像按钮,我想AA下拉菜单。同样,如果我敲击L,左边的菜单应该来。任何想法怎么办?
how to implement it in android. here how the menu i'm looking for. i.e if i click on R image button i want a a drop down menu. similarly if i tap on L, left side menu should come. any idea how to do? .
我不想滑可言,我希望有一个下拉菜单。
I dont want sliding at all, i want a dropdown menu.
推荐答案
关于操作栏的结构,你有两个选择左侧,一个用于右侧。
Regarding the action bar's structure, you have two options for the left side and one for the right side.
启用动作栏下拉导航
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
或的
添加自定义查看
作为通过的 动作条#setCustomView()
,一个微调
的你的情况。
Add a custom View
as navigational element via ActionBar#setCustomView()
, a Spinner
in your case.
添加只有一个菜单项
的动作栏为的自定义操作视图,一个微调
你的情况。
Add only one MenuItem
to the action bar as a custom Action View, a Spinner
in your case.
这篇关于如何实现自定义下拉菜单中的机器人到动作条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!