FAQ Database Discussion Community


Android set menu items dynamically at startup

java,android,fragment,menuitem,action-menu
I need to change the title of a menu item in my action bar at startup based on a few variables which get created at the startup. But for some reason I cant simply do that since the menu items take time to inflate maybe? how do I get around...

How to add menu items separators programmatically on Windows?

windows,delphi,drop-down-menu,menuitem
I have a mainmenu on my Form and I want to be able to insert separator to it programmatically not during design time. I went through context popup menu for the mainmenu that lists all the available properties and did not find anything that will allow me to insert separator....

how to use jquery in wordpress menu?

jquery,html,wordpress,menu,menuitem
Im creating a wp theme , I use this code for menu : <?php $defaults = array( 'theme_location' => '', 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '',...

Creating a MenuItem with a Shortcut of Control+Plus – is using reflection to modify MenuItem's private fields the best method?

c#,.net,winforms,reflection,menuitem
I'm using the legacy MainMenu control (with MenuItems) control in an application, and would like to implement zoom in and zoom out menu items (with Control++ and Control+- keyboard shortcuts). (Note that I'm using MainMenu and not MenuStrip). MenuItem does have a Shortcut property, of type Shortcut, but that doesn't...

Enable/disable a menu item if projects do/not exist in workspace

xml,eclipse,menuitem
I want to enable/disable a menu item, which uses the handler below, depending on whether there are any projects in the workspace. But the following code doesn't work correctly. It enables/disables if a project is selected in the Project Explorer view. I'm not interested in selection, simply whether projects exist...

Why are onPrepareOptionsMenu(Menu menu) and onOptionsItemSelected(MenuItem item) not displaying any menu?

android,menu,fragment,menuitem
I have a problem regarding to the menu which is not showing up when I tap on the menu option. Since I have used onPrepareOptionsMenu(), I was expecting that I have dynamically modified the menu content but it didn't show any menu even after I applied the method onOptionsItemSelected(). *The...

is image_downsize supposed to work inside a custom walker?

wordpress,thumbnails,menuitem
I implemented this custom walker I based on the code here Displaying a wordpress menu with submenu and thumbnail (it should retrieve the image URL to use it as css background, instead of rendering an actual img tag) Everything works fine, except wp_get_attachment_image_src always returnes false. add_filter('walker_nav_menu_start_el', 'generate_nav_images', 20, 4);...

set menu item as to aways show + icon

android,menu,menuitem,overflow-menu
I am enable to set one of the ActionBar menu items as an icon and show it as "showAsAction="always" all I am getting is the overflow menu and a the title of the button instead of the icon. I don't understand what I am doing wrong? this is the code...

javafx retain root while adding a secondary stage

button,javafx,menuitem,stage
I have a growing application with a menu bar with Home, Chapters, Calculator, Glossary, Help. Everything is working fine including the Chapters with 14 items. Also the Calculator that is a source package. It opens but I lose the stage. I would like it to open and able to be...

Android- ActionBar AutoCompleteTextview

java,android,xml,android-actionbar,menuitem
I have added an AutoCompleteTextview in my Actionbar by adding items to xml in menu folder and inflated it.But I am not able to set adapter for my string [] as referring AutoCompleteTextview causes error in line 35,that is . AutoCompleteTextView et=(AutoCompleteTextView)menu.findItem(R.id.search_bar).getActionView().findViewById(R.id.edt); How to solve this problem and make it...

Why onClick event not work on dojo MenuItem?

dojo,onclick,menuitem
I'm studying Dojo 1.10.4, my problem is that the onClick event does not work on dijit/MenuItem. I tried it on other item widgets like dijit/CheckedMenuItem and dijit/RadioMenuItem, none of their click events work, and the API docs didn't give any tips about it. At last, I found it only works...

How can i reference a MenuItem?

c#,menuitem
I am adding MenuItems to my ContextMenu like this: mnuContextMenu.MenuItems.Add("Delete", DeleteFile); Now i want to disable this MenuItem, like this: x.Enabled = false; What MenuItem reference do I have to use for x? ...

Menu item animation, rotate indefinitely its custom icon

android,animation,menu,rotation,menuitem
I have a menu item with an icon (imagine for example a clock with a single lancet), I would like to make its icon rotate indefinitely. How could I manage this effect? Thank you....

MenuItem on ActionBar can't be clicked

android,android-actionbar,share,menuitem,shareactionprovider
I'm trying to implement a share intent to share images. I have a full screen activity which extends ActionBarActivity and a fragment that implements the immersivemode as the android developer's guide explains, so the user can see the image in fullscreen. The problem is that even if I can see...

Switch
  • active element
  • javascript,jquery,html,menuitem
    Here is a link for a fiddle project I am working on right now. What I am trying to do is to switch active menu element depending on what section is displayed right now on screen. So if it is Kontakti on screen, then Kontakti in menu (<!--NAV BAR-->) has...

    list style as closely as possible to the word of the menu

    css,css3,menuitem
    I have this http://jsfiddle.net/zmku8ghk/ HTML <ul id="navi"> <li><a herf="http://google.com">Home</a></li> <li><a herf="#">About</a></li> <li><a herf="#">Contact</a></li> <li><a herf="#">Opc #1</a></li> <li><a herf="#">Opc #1</a></li> </ul> CSS #navi { list-style-type: circle; } #navi li { float:left; list-style-position: inside; } #navi li a { /*text-decoration: none;*/ padding: .2em 1em; color: #fff;...

    Android: Actionbar menuitem icons for gridview and listview styles

    android,icons,menuitem
    Are there default icons for a menu item whose functionality is to change gridview to listview or vice versa. I know there are some icons like search, done, edit etc. I just couldn't find any for this purpose.

    Refresh Menu with invalidate android

    android,menuitem
    I am working on android application in which i want to refresh my menu on run time. For example if in the starting my Menu is like menu1.xml then after getting any result for example 'Yes' from the server i want to refresh it with menu2.xml. I want to use...

    Android contextual action bar with custom ListView not allowing multiple selection

    android,android-listview,menuitem,contextual-action-bar,android-contextmenu
    I followed Android API guide implementing CAB and I have several problems: Multiple selection not exist Selected items (rows) not colored to indicate they are selected How to change: [A] color of the CAB [B] Show some text on the CAB The current output is single selection, without coloring the...

    Passing a value from menu items

    asp.net,menu,menuitem
    I would like to pass a value from menu item to the respected navigation page. <asp:menu id="myMenu" staticdisplaylevels="2" staticsubmenuindent="10" orientation="Horizontal" dynamichorizontaloffset="10" onmenuitemclick="myMenu_MenuItemClick" target="_blank" runat="server" ForeColor="White" > <items> <asp:menuitem text="Home" tooltip="Home"> <asp:menuitem text="Music" tooltip="Music"> <asp:menuitem text="Classical" tooltip="Classical"/> <asp:menuitem text="Rock" tooltip="Rock"/> <asp:menuitem...

    how to add menu items to action bar in more than 30 activities

    android,android-activity,android-studio,menu,menuitem
    I have created an app in android studio that has more than 30 activities .I created menu items in some activities by adding them in individual menu files and they worked fine . But the problem is that it is a real headache to add all the menu items in...

    C# conditional statements in menuitem in asp.net

    c#,asp.net,conditional,menuitem
    My project has been changed to C#, from VB. I do want the conditional to be done in the menuitem. I realize there may be other ways of doing it, however, I want it to be done in the menuitem. I need to do a conditional in the menuitem so...

    How add a single menu item left to the toolbar in android?

    android,toolbar,menuitem,android-toolbar,android-actionbaractivity
    I simply want a back button in left side of toolbar.But when i added with following code ,appear in right side of toolbar.how can i change to it to left side? my code <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.me.myapp.activities.Timer"> <item android:id="@+id/backButton" android:title="Back Button" android:icon="@mipmap/back_icon" app:showAsAction="ifRoom"></item> </menu> ...

    Hide MenuItem in one Fragment in FragmentActivity with swipe tabs functionality

    android,android-fragments,menuitem
    I've a FragmentActivity with three swipe tabs. I've added a REFRESH Icon as MenuItem in actionbar and inflated that menu in FragmentActivity by overriding onCreateOptionsMenu. @Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub getMenuInflater().inflate(R.menu.live_stream_item, menu); refreshMenuItem = (MenuItem) menu.getItem(0); refreshMenuItem.setVisible(true); return super.onCreateOptionsMenu(menu); } I've globally declared refreshMenuItem...

    Android: Updating a menu item programmatically results in NullPointerException

    android,nullpointerexception,menuitem
    I am working on a RecylcerView and CardView. The cards contain ImageView. I also have an menu-item that is declared as an action and whose title is set to 0. What I want to achieve is that when I click on the image its position should be added to an...

    Why does primefaces menuitem need a form?

    forms,primefaces,menu,menuitem
    Why does my menu in primefaces need a form around is? Is this the best way? Form needed: <h:form id="menuForm"> <p:menu> <p:menuitem value="Simple Flow" action="simple-flow" ajax="false"/> </p:menu> </h:form> No form needed: <p:menu> <p:menuitem value="Simple Flow" outcome="/simple-flow/simple-flow"/> </p:menu> ...

    one menu item for two actions

    android,menuitem,optionmenu
    I have option menu configured and one of the items is used to enable a service in the background. When the action takes place I am changing the item title from "Enable Service" to "Disable service" and setting a boolean value accordingly. the issue starts when the app closes and...

    Android: how to change menu item at page scrolling with ViewPager?

    android,android-fragments,tabs,menuitem,swipe-gesture
    The last version of WhatsApp does what I'm talking about. When you scroll between tabs the toolbar shows different menu options. I can implement ViewPager with adapter and fragments but not this. How could it be done? I really don't know what kind of trick is behind. It changes everytime...

    Menu Item not detecting users' click on action_finish button

    android,android-studio,menuitem
    I have a ScreenSlideActivity.java sliding fragments with a pager. Since I want to create a tutorial with the Screen Slide Animation, I want to navigate the user back to the main activity when he presses the "finish" button. My problem is that the menu item inside onOptionsItemSelected doesn't detect the...

    Android : Menu items can't be removed in the fragment

    android,android-fragments,menu,menuitem
    I need to remove the inflated menu after I return to Fragment 1 from Fragment 2 after some action. I clear the menu after I make the popBackStack, but nevertheless the menu item can't be deleted. @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); if (savedItemsExist()) inflater.inflate(R.menu.menu_saved_filters, menu); else...

    What is the best way to properly center a logo on an ActionBar?

    android,menu,android-actionbar,menuitem
    The purpose of what I want to achieve is to center a custom logo on the ActionBar. I have the following custom layout for my ActionBar: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:contentDescription="@string/app_name" android:src="@drawable/logo_header" /> </FrameLayout> This gives the expected...

    Calling modifiedPopupWindow class from Actionbar Menuitem: Is this even possible?

    android,android-activity,android-actionbar,menuitem,android-popupwindow
    I have a PopupWindow that I'd like to call from a menu item in the action bar. PopupWindow class is, public class speciesPopupWindow { Context ctx; Button btnDismiss, ...; public speciesPopupWindow(Context ctx){ this.ctx = ctx; } public void init(View v){ LayoutInflater inflater = (LayoutInflater) ctx.getSystemService... View popUpView = inflater.inflate(R.layout.popup_layout,... final...

    Error when getting ContextMenu and adding new item

    contextmenu,javafx-8,menuitem
    So I have controller class with this object: @FXML private TextArea textArea; then Im trying to add new MenuItem to its standard Items(that is "copy" and "select all") @Override public void initialize(URL location, ResourceBundle resources) { ContextMenu contextMenu = textArea.getContextMenu(); X contextMenu.getItems().add(new MenuItem("chuj")); textArea.setContextMenu(contextMenu); and line marked with X gets...