Since Android 4.4 was introduced I had this big question about translucent notification and navigation bar:
How do you make a custom theme so that the notification bar is the same color as the action bar as well as the navigation bar be the same color that the current activity is?
A good example of this is the Trello app:
And:
Even if you open a navigation drawer, the navigation bar still retains its color. How does one achieve this?
You can use the new (as of 4.4) Theme.Holo.NoActionBar.TranslucentDecor or Theme.Holo.Light.NoActionBar.TranslucentDecor themes. Or you can set windowTranslucentNavigation in your theme. You'll also want to fill the area behind the system bars by setting fitsSystemWindows to true in your layout.
More info in the Android 4.4 APIs changes document
Related
I am currently working on a cross platform mobile app using Xamarin forms. I also apply the Visual material in order to have a consistent UI between iOS and Android through Material design theme.
But I got a point I want some advices.
After choosing my color palette you can see a snapshot in this link : https://material.io/resources/color/#!/?view.left=0&view.right=0&primary.color=039BE5&secondary.color=FFC107
For Navigation, I had a bottom navigation bar and I set it its background color with the secondary color (the yellow one if you clicked on link above) .
Is it a good practice or the bottom navigation bar should be white or be colorPrimary of my Theme.
Thanks in advance
Actually I am using
#android:style/Theme.Holo.Wallpaper.NoTitleBar
in my android launcher app. But the problem is when I am changing
navigation bar color
for lollipop and above devices, it's not changing. I tried pro-grammatically as well as from styles.xml.
If I am using appcompat theme, then it's working. But I don't wanna use appcompat theme for my launcher app. So what is the reason behind it and give me solution as well.
I'm trying to achieve the effect shown here: http://www.youtube.com/watch?v=6QHkv-bSlds&t=15m48s by Nick and the boys. I can get the action bar to be overlayed, but cannot figure out how to extend this to the status bar. I would also like to know how they managed the transparent black background behind the navigation bar (but this isn't as crucial).
Any help / advice would be greatly appreciated as I currently have no idea how this is done (and am starting to worry it may just be an image rather than an actual implementation).
Edit: i know how to make the bars fully transparent (thats the easy part)! I dont know how to extend the actionbar background to appear behind the now transluscent status bar
I had the same question and found this library: https://github.com/jgilfelt/SystemBarTint
Have a look at line 300 in:
https://github.com/jgilfelt/SystemBarTint/blob/master/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java
setupStatusBarView() Adds a view to the window's decor. This allows you to later set a color/drawable to this view.
If using the SystemBarTint library, the following will allow you to force the status bar to a specified color, which you can then match to your action bar's background:
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(Color.parseColor("#DD000000"));
In this case you would set your action bar's background to: #DD000000
As described in the Android 4.4 APIs:
You can now make the system bars partially translucent with new themes, Theme.Holo.NoActionBar.TranslucentDecor and Theme.Holo.Light.NoActionBar.TranslucentDecor. By enabling translucent system bars, your layout will fill the area behind the system bars, so you must also enable fitsSystemWindows for the portion of your layout that should not be covered by the system bars.
If you're creating a custom theme, set one of these themes as the parent theme or include the windowTranslucentNavigation and windowTranslucentStatus style properties in your theme.
In your case (where you want the ActionBar), the second option - including the two new properties into your theme - will give you a translucent Navigation and Status bar.
They are using the new Translucent system bars feature (on Android 4.4 and up).
Translucent system bars
You can now make the system bars partially translucent with new
themes, Theme.Holo.NoActionBar.TranslucentDecor and
Theme.Holo.Light.NoActionBar.TranslucentDecor. By enabling translucent
system bars, your layout will fill the area behind the system bars, so
you must also enable fitsSystemWindows for the portion of your layout
that should not be covered by the system bars.
If you're creating a custom theme, set one of these themes as the
parent theme or include the windowTranslucentNavigation and
windowTranslucentStatus style properties in your theme.
I wanted to know if there's a way to change the status bar background color as well as the icons on Android phones. Will changing the background and button color of the navigation bar also works?(e.g. in Nexus devices or others with software buttons only)
I wanted to develop an app which changes these colors so it fits the apps UI(like on the iOS, or on the PanaroidAndroid ROM). There should be some workaround, at least with root permission(?)
HINT: With navigation bar I mean the bar at the bottom of the screen that displays the soft keys, NOT to be confused with the android action-bar!
Is it possible to use fragment tabs on action bar with the Theme.Holo.NoActionBar theme?
I mean... I already use this theme on my layouts but apparently it is overriden since the fragments have to show up in the action bar?
What I wanted to achieve is to actually get rid of the Title and App Icon over the fragment tabs. Something similar to the Google Music app.
Is this possible?
What I wanted to achieve is to actually get rid of the Title and App Icon over the fragment tabs. Something similar to the Google Music app.
Try calling setDisplayShowHomeEnabled(false) and setDisplayShowTitleEnabled(false) on your ActionBar, and leave the theme alone.
You can style the action bar based on your needs. I'm quite certain you can also remove the app icon and title from there. Using a NoActionbar theme by default and then recreating the action bar on your own kinda defeats the purpose of the action bar. I suggest you use a theme with action bar and then style the bar according to your needs. This page has a decent implementation.