menuitem

Android: Changing visibility on menu items with changing fragment

妖精的绣舞 提交于 2019-12-05 03:25:47
I want to change the visibility of menu items of a fragment activity (abs) when ever I change the fragment in the activity. The fragments are SherlockListFragments. The menu items I want to show/hide are spinners I create on menu creation: public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. MenuInflater inflater = getSupportMenuInflater(); IcsSpinner herbSortSpinner = new IcsSpinner(this, null, R.attr.actionDropDownStyle); SpinnerAdapter herbSortSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.herb_sort_elements

Changing options menu icon in actionbar depending on an open Fragment

允我心安 提交于 2019-12-05 01:28:47
I have this item in my options menu: <item android:id="@+id/opt_mnu_action" android:icon="@android:drawable/ic_dialog_info" android:orderInCategory="1" android:showAsAction="ifRoom" android:title="New"> </item> The menu itself created in main FragmentActivity. I want to change this item's icon programmatically depending on the open Fragment and, obviously, have different actions when the user hits this button. I tried several things to do that, but nothing worked. The last thing I tried was this code in my Fragment's onCreateView method: MenuItem mi = (MenuItem) view.findViewById(R.id.opt_mnu

Add a MenuItem to Menu at specific position or group programmatically

送分小仙女□ 提交于 2019-12-05 00:58:54
I have a <android.support.design.widget.NavigationView app:menu="@menu/drawer" /> with the following menu items: <item android:id="@+id/main_item" android:icon="@drawable/ic_menu_main" android:title="@string/app_name"/> <group android:id="@+id/some_group" android:checkableBehavior="single"/> <item android:id="@+id/teams_item" android:icon="@drawable/ic_menu_teams" android:title="@string/teams"/> Now I want to add an item either to the some_group or just below it. I tried: MenuItem mi = menu.add( R.id.soume_group, someId, NONE, "some name" ); or MenuItem mi = menu.add( R.id.soume_group, someId,

ActionBarSherlock hardkey menu panel text color

牧云@^-^@ 提交于 2019-12-05 00:29:57
I have a small question about theming my app that uses ActionBarSherlock. Everything works fine except on Samsung phones with TouchWizz . The overflow menu items appear by pressing the hardware menu key. I know how to change the panel background. My default theme extends Theme.Sherlock.Light.DarkActionBar , so the default menu item text color in the hardware panel will be black , I wan't to change this. Any ideas on how to do this besides changing the parent of my default theme? <style name="Theme.MyApp" parent="@style/Theme.Sherlock.Light.DarkActionBar"> <item name="android:panelBackground">

How can I prevent a main menu item with sub items from being clickable in Wordpress?

依然范特西╮ 提交于 2019-12-04 19:43:15
Here is my site: http://wake9.com/blogs/norcal-merced-wakesurfing-competition-2009/ . Notice the menu item "Photos and Results". Hover over it and you will see sub menu items. I want to be able to click on the sub-menu items but the main menu item shouldn't be a page or be clickable. The only way i could get this item on the menu was to make it a page. Is there a way to just have a menu item that has sub menu items to content, but the actual menu item isn't clickable? I was thinking about using JQuery to remove the anchor tag, but that is a real hack and I want to know if there is an easier

Not Showing Any Sign of Menu Button when there is not any default menu button in devices

六眼飞鱼酱① 提交于 2019-12-04 16:28:07
I am Working on One Application which has Settings Screen which Opens When User Click on OptionMenu Shortcut which shows on Devices as Default Button or any other Sign. it Works fine when there is default menu button in device but not getting any Sign for Menu Option when there is not any default menu button in devices. My Code is as Below: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_setting, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.btnSettingMenu: Intent

RelayCommand not firing on MenuItem click WPF MVVM

安稳与你 提交于 2019-12-04 15:02:14
I have menu item on my WPF form that runs a import routine, I have bound the command property to a ICommand property in my view model but for some reason the method won't fire. This is the xaml: <Menu Height="21" Margin="0,-2,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"> <MenuItem Header="File" Command="{Binding ImportFileCommand}">Import</MenuItem> </Menu> And this is in my view model: private ICommand importfilecommand; public ICommand ImportFileCommand { get { if (this.importfilecommand == null) { this.importfilecommand = new RelayCommand(parm => ImportFile()); } return this

Dynamically add action item in action bar

一曲冷凌霜 提交于 2019-12-04 12:49:27
I want to create my action menu items in the ActionBar totally dinamically for some reasons. But when I add the menu items from code, they are displayed as overflow of the setting menu item. Below there is my code. any solution? @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. //getMenuInflater().inflate(R.menu.start, menu); MenuItem logoutMI= menu.add(0,1,0,"Logout"); logoutMI.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); logoutMI.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT); MenuItem configMI= menu.add

Android NavigationView : not show full item and not truncate

对着背影说爱祢 提交于 2019-12-04 11:38:30
Problem : NavigationView not show full text of menu item, also not truncate text . This item I see correctly - two words " Small title ": <item android:id="@+id/example1" android:icon="@drawable/filter_2" android:title="Small title" android:checked="false" app:actionLayout="@layout/menu_counter" /> /> And with next item - I see only first two words " Small title " without any truncate of next word " andveryverylongword ": <item android:id="@+id/example2" android:icon="@drawable/filter_2" android:title="Small title andveryverylongword" android:checked="false" app:actionLayout="@layout/menu

How to put overlay View over action bar Sherlock

孤街醉人 提交于 2019-12-04 08:37:13
问题 I want to set some view over action bar that will display Tutorial text (Like click here and send email...). Is this possible? I ask because i know that action bar uses the top space on layout, and a fragment or activity uses remaining space. My second question is how to display all action items on action bar. I use ActionBarSherlock library and i see that i have room for one more action item, but it's not displaying on action bar. I set in xml ifRoom option on item... Thanks!!! 回答1: There