Is it possible to prevent the navigation bar on Android <4.4? - java

In my application I want to prevent the display of the navigation bar. In Android 4.4 it's easy to implement (see here: How to hide navigation bar permanently in android activity?), but lower versions can't do this.
I saw a similar mechanism in some players which hide navigation bar in fullscreen without any possibility to display it when the screen is touched.
I would be grateful for tips or code samples as it can be done.
Thank you.

SYSTEM_UI_FLAG_HIDE_NAVIGATION is available since API level 16.
So it works since Android 4.1+. You have to remember to reset this flag every time the user makes the NavigationBar show up again.
Only the immersive mode is only available since 4.4

Related

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

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.

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 change the foreground nav bar color?

Within my Android app, I want to change the foreground of the navigation bar from default white to any other color programmatically in Java.
For instance -
to
I've searched Stack Overflow, the web, and Android Developers.
There are many posts about changing the background with
getWindow().setNavigationBarColor(mColor);
But I can't figure out how to change the foreground. Any help is appreciated.

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.

Android Action Bar Title Text not clickable on certain phones

I have a project that I am currently updating. In previous versions I have been able to select the title text, and it would react as part of the back button in the action bar. I currently have no icon in the actionbar by design and in previous versions the text was still interactive.
I tried implementing different layouts for varying screen sizes, however, since then on normal and small screen sized phones (tested: Samsung Galaxy S III Mini and Sony Xperia tipo) now only the back button ("<") reacts to touch.
The title text is still clickable on an Samsung Galaxy S4 and a Nexus 4. I have reverted the code back to how it was before I made those changes, along with trying code from last week to make sure nothing has changed, and the bug still occurs. I have tried other apps on the Samsung Galaxy S III Mini and the text in RedReader is clickable, so it's definitely app side, but I am not sure what has changed that will cause this.
I am currently at a loss as to why it is doing it. I've also attempted to update ActionBarSherlock to see if that may have caused an issue, but I am not sure what to try next.
Title on ActionBar is clickable from 4.2.2 version of Android. Before only < or icon.
If you have the need to implement this functionality in previous versions (including versions 2.x), you can use the ActionBarSherlock.
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
Visit http://actionbarsherlock.com/

Categories