Posts

Showing posts with the label drop-down-menu

How to make any imagebutton a menu button

How to make any imagebutton a menu button I have an imageButton in a xml file. Now want to make it a menu button, so that when a user click on the button it should show the drop down menus. But I am not able to figure out what are the possible solution(s). Can anyone help? 2 Answers 2 If you're trying to show a drop down menu when clicking an ImageButton (or any other View ), try this: final ImageButton imageButton = // get your ImageButton from the XML here final PopupMenu dropDownMenu = new PopupMenu(getContext(), imageButton); final Menu menu = dropDownMenu.getMenu(); // add your items: menu.add(0, 0, 0, "An item"); menu.add(0, 1, 0, "Another item"); // OR inflate your menu from an XML: dropDownMenu.getMenuInflater().inflate(R.menu.some_menu, menu); dropDownMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuIte...

NodeJS Auto-Update Dropdown menu based on MySQL queries

NodeJS Auto-Update Dropdown menu based on MySQL queries This is my first project working with Express & NodeJS so please bear with me, as I a a total newbie to JavaScript. I am currently trying to figure out how to create a dropdown menu that changes its values based on the options "pais", "titulacion" and "destino" selected from this DB (outgoing): +--------+-----------+------------+-----------+------------+----+ | nombre | apellidos | destino | pais | titulacion | id | +--------+-----------+------------+-----------+------------+----+ | John | Martinez | UPMC | Francia | GIB | 1 | | Marta | López | HEC | Francia | GITST | 2 | | Amadeo | Perez | Linköping | Finlandia | GITST | 3 | +--------+-----------+------------+-----------+------------+----+ I want to make it so that if I select "Francia" on the dropdown list, the other dropdown list for "destino" will only show those opt...