android - how should I add some action Items to a dialog? -
i have custom dialog want add action items icon android calender .
here manifest code give theme activity :
<activity android:name=".filechooser" android:label="filechooser" android:theme="@android:style/theme.devicedefault.dialog" tools:ignore="newapi"> </activity>
and in filechooser.java :
public boolean oncreateoptionsmenu(menu menu) { menuitem camramnu= menu.add(0,0,0,"take picture"); { camramnu.seticon(r.drawable.camera); camramnu.setshowasaction(menuitem.show_as_action_always); } return true; }
and never show icon !
how can ?
i see problem - you've got options menu, included image there's looks contextual action bar menu running, "done" , "cancel"
maybe need set menu options on that
http://developer.android.com/guide/topics/ui/menus.html#cab
in case,
private actionmode.callback mactionmodecallback = new actionmode.callback() { // called when action mode created; startactionmode() called @override public boolean oncreateactionmode(actionmode mode, menu menu) { // inflate menu resource providing context menu items menuinflater inflater = mode.getmenuinflater(); inflater.inflate(r.menu.context_menu, menu); return true; } // called each time action mode shown. called after oncreateactionmode, // may called multiple times if mode invalidated. @override public boolean onprepareactionmode(actionmode mode, menu menu) { return false; // return false if nothing done } // called when user selects contextual menu item @override public boolean onactionitemclicked(actionmode mode, menuitem item) { switch (item.getitemid()) { case r.id.menu_share: sharecurrentitem(); mode.finish(); // action picked, close cab return true; default: return false; } } // called when user exits action mode @override public void ondestroyactionmode(actionmode mode) { mactionmode = null; }
};
Comments
Post a Comment