RefreshActionItem icon indicating copy to clipboard operation
RefreshActionItem copied to clipboard

how to addSubMenu ?

Open liufsd opened this issue 11 years ago • 4 comments

hi man! i mean how can i to add the menu item just like this :+1: SubMenu rootMenu = menu.addSubMenu(""); MenuItem rootMenuItem = rootMenu.getItem(); rootMenuItem.setIcon(R.drawable.actionbar_icon_overflow); rootMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); rootMenu.add(android.view.Menu.NONE, 1, android.view.Menu.NONE, "1"); rootMenu.add(android.view.Menu.NONE, 2, android.view.Menu.NONE, "2"); when i select "1",i need the top bar show progress ,just like your StyledActivity! ( mSaveButton.showProgress(true);)

liufsd avatar Jun 27 '13 05:06 liufsd

Let me see if I understand. You want to have the "refresh" action in the overflow menu instead of having it as an icon in the action bar? And you want the progress indicator to appear in the action bar when you click on the "refresh" menu item?

In case your progress indicator is indeterminate you can do it quite easily without using my library, just do as this SO answer says:

http://stackoverflow.com/a/9060543/244576

In case you need a determinate progress indicator like the one in my library (it looks like a pie), then let me know and I might consider adding support for that. In fact it's a possibility that had already crossed my mind.

ManuelPeinado avatar Jun 27 '13 06:06 ManuelPeinado

yeah ! i solve it by myself ! when it select the item ,it will change the action bar view (invalidateOptionsMenu call the onCreateOptionsMenu, and use your bar library),so i can show progress. ok. if the task return the result ,it will call the dismiss just like this " mRefreshActionItem.showProgress(false);" and invalidateOptionsMenu! so the will show my action bar ! however ,maybe it not a good idea for it! Do you have some good idea ? Thanks!

liufsd avatar Jun 27 '13 07:06 liufsd

just like two menu switch ? the task start ,call your library and then call my action bar item when task finish! just call android api "invalidateOptionsMenu", and you can control the switch in the "onCreateOptionsMenu" method (return different action bar item)

liufsd avatar Jun 27 '13 07:06 liufsd

if you got it .please tell me! Thanks!

liufsd avatar Jun 27 '13 07:06 liufsd