I have an app with a normal menu i.e. the common old menu that shows up at the bottom of the screen when the menu button is pressed. But it is a problem in some phones where there is no hard menu button.
I want to switch to slider menu with a menu icon on top. Is there an easy way to do this (I mean a way where code change would be minimum) retaining the existing functionality? Or will i have to go about coding the slider menu from scratch?
Any example code of a similar situation would really help.
I have an app with a normal menu i.e. the common old menu that shows up at the bottom of the screen when the menu button is pressed
Normally, that "menu" will appear as the overflow on devices with an action bar that either:
do not have a MENU button, or
run Android 4.4+
But it is a problem in some phones where there is no hard menu button.
Make sure that your app has an action bar.
I want to switch to slider menu with a menu icon on top
The options menu/action-bar-with-overflow is unrelated to the "slider menu". They serve different roles. Please read the design guidelines for a navigation drawer (a.k.a., "slider menu").
Is there an easy way to do this (I mean a way where code change would be minimum) retaining the existing functionality?
No, because they are not related.
Related
I'm currently working on a school assignment where I need to create an app for visually impaired users. I would like to use Java with JavaFx for GUI.
Preferred element for visually impaired users is menu bar, since it can be easily navigated by keyboard. Menu bar in JavaFx is a MenuBar class object, that has Menu class attribute, which has MenuItem class attributes. Windows Narrator (neither the NVDA screen reader) works with this menu bar out of the box. It won't read the labels at all. It just says "Menu" and that's it.
Menu and MenuItem do not have accessibleText attribute which stores the text to be read by the screen reader software. Is there a way to make this menu bar screen reader compatible?
TL;DR: Is there a way to create menu bar that works with Windows Narrator in JavaFx?
For future reference: I've managed to solve this. The issue was I didn't have Java Access Bridge enabled (https://docs.oracle.com/javase/7/docs/technotes/guides/access/enable_and_test.html). Enabling it made the menu bar work without any other changes.
I have a Floating Action Button with a custom menu of mini Floating Action Buttons, that appears upon click on the main Floating Action Button.
The mini FABs are in a LinearLayout.
I want that after opening the FAB menu, when the user clicks elsewhere, the menu disappears. However, I haven't been able to find how to do this.
What listener do I need for this?
Any help?
Thanks.
You are most likely interested in a custom FloatingActionButton.Behavior:
https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.Behavior.html
https://medium.com/#nullthemall/floatingactionmenu-floatingactionbutton-behavior-dd33cc0d9ba7#.jsvuvz2rk
Otherwise you can simply set the Visibility of the respective controls to Gone based on a OnTouchListener that checks if you are touching outside the FAB.
I have a custom JFrame. On the title bar I have an icon in the top left, a title, and then the standard minimize, maximize, and close buttons on the right.
When I click the icon in the title bar I get the standard options: Restore, Move, Size, Minimize, Maximize, Close.
How can I add my own menu option here? I'd like to add and "Always On Top" option here.
Additionally I'd like to add a button next to the max,min,close buttons on the title bar to allow uses to toggle the "Always On Top" state of the JFrame.
You could create your own customized Components. To do that, create a new class which extends JMenuBar for example and override the methods which fit your needs. Very often, for example, one wants to override paintComponent(Graphics).
That is not what you want, 'though. Customizing the JMenuBar wont work as you expect it to. The "JMenuBar" is another bar below the title bar. I am Mac user, but as far as my knowledge goes, it is not possible to customize the title bar, because that isn't handled by the JVM. The only thing that is modifiable without using native code is the Icon in the top left.
For further information on that, look at this question and the best answer there. This will help you a lot.
Your problem (adding a button at the top for toggling the alwaysOnTop status) is best solved by creating normal instances of a JMenuBar, a JMenu and a JMenuItem.
To then add that MenuBar to your Frame, use JFrame.setJMenuBar(JMenuBar). See also How to use Menus.
I hope this helps!
In my application (only for my application), I want to add a button to the navigation system bar
How I can do that in my code?
You cannot do anything there. Not to mention some devices will not show this bar at all if they got hardware buttons.
You can't.
Maybe try to add a fragment that will be exactly above it.
Some phones don't even have that buttons on screen.
firstly check mobile or tab has soft buttons if has then make full screen by programaticaly after that create custum button bar like tab bar at bottom and put buttons as you like thats better if u dont have any other idea
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
I'm trying to add a system tray icon, with a right click menu on the icon, for a javafx program.
The answers I've found indicate that the only way to do this is via java.awt.SystemTray
Which is fine, but the popup menu which shows up when I right click the icon in tray, looks very bland. Also, if I hover the mouse over any of the popup menu options, I expect the background color of that option to change, to indicate that I'm selecting it. But this doesn't happen, the menu stays completely static and unchanging until I click an option.
I'm looking for a way that I can listen to the mouseover event on a MenuItem and change its background + foreground color to indicate that it has the focus. But I can't find any methods in the API that let you do this. Is there any other way? Or is there anything else I can do to make the menu seem a bit more responsive?