How to add a button to the Android system navigation bar? - java

I need to add an additional button to the right of the system buttons, as shown in the photo. clicking on it will perform a specific action related to my app. Can this be done?

In general: No. There's not an API for this, only the OS can control the navigation area. Consider also the problems you'd run into with the variety of system navigation styles available, many of which, like gesture navigation, don't even have buttons.
Some apps fake things with screen overlays that reimplement some or all of the navigation and/or hide the system navigation, but you're going to run into all of the above issues doing so, plus the issues inherent in screen overlays, plus you'll have no guarantee that however you do it will continue to work into the future. I wouldn't recommend trying this approach.

Related

How to disable a particular button/link in a webview in android

I am new to Android development. Created a simple application with a webview. Webview loads a url. Now I want to disable only one button from the website. How can I do that using the class name of the button?
you shouldn't. if you decided to make a web GUI then handle actions in "web" way (JS?). if you want to handle natively clicks and other actions (different gestures, scroll, etc.) then make native GUI with XML. making such hybrid as you decribed, while possible e.g. using JS interface for making communication web<->native sides, is waste of time and resources (for handling whole GUI, especially so basic actions like clicks or enablind/disabling items)

Hiding the NavBar

I am trying to reveal the navbar only when touched at a specific area on the screen.
Is that possible. I was able to hide it. The problem is it could be revealed by touching either the top or the bottom.
If you want to get the navigation interface out of the way as much as possible, Sticky Immersive Mode is what you're looking for. The user can always swipe on an edge to bring up navigation, but it's transparent and your app will still receive the swipe gesture as if nothing had happened. Access to navigation is always there for the user so they can't be trapped in an app with no way out.
You can add buttons or other controls in your app to show or hide the navigation interface if that's still something you want to do. The Advanced Immersive Mode sample provided with Android Studio shows how.

How do I modify default android auto activity bar

I am trying to figure out how can I modify the icons and interchange the order that appear in android auto navigation activity.
So far I have found this code needs to be modified directly in AOSP. The file that I think that is drawing this is CarNavigationBarController.java
I have not been able to figure out the resource that I need to modify the icons and their order.
Thank you in advance.
You can't.
This bar is generated by Google's Android Auto application and it's proprietary.
The Android Auto playback menu is standard, and the third party apps are not allowed to change the interface
You can only customize the color of the button, to distinguish your brand for some degree. Otherwise, the experience should be consistent and predictable to minimize the drivers distraction.

Designing xml layouts for different screen: Android

I am working on a small app, with 3 buttons on left corner(Vertically) and a edit box which covers rest of the screen.
I want to run this app to be able to work on all screen resolutions.
So I have used Relative layout, linear layout and Android:weight for buttons, which equally share the size of the buttons and works fine.
My Question is am I doing it wrong?
Should we design different layouts for different screens or using same layout out but adding properties like weight and padding is fine??
So, you want a responsive layout for your android app.
Pointing to your question :
[+1] layout -> Relative / Linear (in addition to the relative layout)
property (Buttons) -> Android:weight
is the right thing you are doing for your app.
Alternative:
But if you want a more responsive design then you could follow responsive design techniques by using html5 & css3 media queries etc. . And, could opt for a fluid layout also. By doing this the advantages you will have are:
Won't have a native UI only for android but the same could be used for other platforms (iOS,blackberry etc.) if you require.
The design would be more seamless with the native browser and the widgets won't get obsolete ever in the newer versions of your android
platform also and changes once done would be reflected over the other
platforms too.
More info: MUST READ IF YOU WANT CLEAR UNDERSTANDING OF HOW TO DESIGN FOR ANDROID
http://developer.android.com/design/style/devices-displays.html
http://developer.android.com/design/style/metrics-grids.html#48dp-rhythm
you can see this Supporting Multiple Screens and also Designing for Multiple Screens
To support different screen size you have to implement different layout.
Under res directory you should create these directory:
layout
layout-small
layout-large
layout-xlarge
In each directory you implement your layout. be aware to call all the layouts with the same name.
If you want to support the landscape mode too you have to add:
layout-small-land
layout-large-land
layout-land
When, in Eclipse, you open the layout select the tab called 'Graphical Layout' , you will see how your layout will be displayed. Change the screen size using the options in the upper left side and you can check how it will be displayed in different screen size.
If something is wrong you can open the xml using and correct it.
I've created a small tutorial here Multiple screen support
Hope this help you

Java Swing : Alt-tab styled menu (context switching menu)

Are there any current implementations or frameworks for Java Swing that include functionality for a context-switcher menu?
More detail:
In our application, we have several sub-parts of the application, and only one of them is displayed at once. Presently there are several ways to switch between them, including tool bar buttons and via the View menu. We would like to add another means, that is accessible via a keyboard shortcut. This would bring up a context-switch menu, similar in concept to those available in modern OS'es.
If you press Alt+Tab and release the Tab while still holding down Alt, you will get a little window in the middle of the screen, displaying the various applications that are running at the moment. In Ubuntu, you get a screenshot of each application, plus its window manager icon. In Windows you get the window manager icons, and so on.
I think this is possible. You could apply a transformation to a Graphics option that you pass to each JFrame and have it paint a small version of itself on it. Then take those images and place them on a GlassPane on top of your application. The highlighting of the selected window might be tricky, but I think it would work nicely.

Categories