I want to create my own Android app and my problem is that I can only see a charging icon in the status bar instead of battery, time, wifi etc.
Above you can see how it looks, but there is not much to see.
In styles.xml I chose this Theme:
style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar
If you need more information just ask.
I found out that my status bar was white because the colorPrimaryDark in colors.xml was white. And normally the status bar has the color of PrimaryDark.
Related
I need to configure the system bar and navigation bar like Google's Google Pay App.
PSB screenshot:
I have marked the bars with green color.
When we open the google pay app, these bar's color changes to white and it feels like they are part of the app.
Also we can scroll out text/images and display them up in system bar.
The experience is immersive.
I need same design for my app (i.e. transparent/colorless system and navigation bars)
How to achieve this in a proper way without touching any base functionality ?
I read this article: Enable fullscreen mode
And I also read lot of answers around this area but could not find a solution.
Please advice how to achieve it like google pay app ?
And how I can display my text in system bar when scrolling ?
this requires min API 23 (maybe i'm wrong) The answer is in the documentation as usual
https://developer.android.com/training/gestures/edge-to-edge#change-color
briefly: you should edit the themes.xml
<!-- values-v29/themes.xml -->
<style name="Theme.MyApp">
<item name="android:navigationBarColor">
#android:color/transparent
</item>
<!-- Optional: set to transparent if your app is drawing behind the status bar. -->
<item name="android:statusBarColor">
#android:color/transparent
</item>
<!-- Optional: set the status bar light and content dark. -->
<item name="android:windowLightStatusBar">
true
</item>
</style>
Can I prevent the colour of the status bar becoming colorPrimary? I mean, I do not want to change the status bar colour, and leave it as it is (system default). I have searched Google for this, and the answer was hiding the status bar. But I do not want to hide it.
I also do not want to change the primary colour to that of the default colour of the status bar. I need the primary colour as it is for other things. I just do not want it to be applied to the status bar.
I know that was the default behaviour before Lollipop. Is this still possible after Lollipop?
This should work
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">#000000</item>
</style>
In your application theme, set status bar color as below:
<item name="statusBarColor">"YOUR_COLOUR_CODE"</item>
I want to set the color of status bar to white and icons such as wifi and battery to black. How can I do this?. I will prefer to do this via using Theme.AppCompat
The color of the status bar can be changed by :
<item name="colorPrimaryDark">your_required_color</item>
From API 21, to change color of status bar without using "colorPrimaryDark" use:
<item name="android:statusBarColor">your_required_color</item>
Since Lollipop. Starting with Android 5.0, the guidelines say:
Notification icons must be entirely white.
Even if they're not, the system will only consider the alpha channel of your icon, rendering them white
Refer this : Android statusbar icons color
But from API 23, to change system status icons to semitransparent black you can use :
<item name="android:windowLightStatusBar">true</item>
Refer this : https://plus.google.com/+RomanNurik/posts/4WBSonAZxt1
You can change your statusBarColor by typing below attribute in your style.xml you need to input this code in your base theme.
<item name="android:statusBarColor">COLOR THAT YOU WANT TO CHANGE</item>
I have searched a lot about this but all I have found is how to change status bar color.
I want to invert color of icons in status bar on white background like Soundcloud has done in its mobile application like:
How to do this?
You can do that with the following code. it's just working on v23 API.
In your: values-v23/styles.xml:
<item name="android:windowLightStatusBar">true</item>
Check this link for more information: https://stackoverflow.com/a/30075921/4409113
Or: https://stackoverflow.com/a/33316669/4409113
I'd like to know what's the name of the part on top of the action bar (where the time is displayed alongside the battery, wifi, etc), and how can its color be changed ?
Thanks !
That's the status bar.
Just add colorPrimaryDark item to your theme in styles.xml
<item name="colorPrimaryDark">#color/primary.dark</item>