Complete mystery about getting the status bar TEXT to appear, when immersive - java

"windowLightStatusBar" not working?
Android app, 24+ only
One: Set theme to eliminate action bar ..
<style name="FattieTheme" parent="Theme.AppCompat.Light.NoActionBar">
Action bar is gone.
Two: Just after super.onCreate , eliminate the bottom nav bar with exactly these three flags:
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
(Aside: after mammoth experimentation it appears to make no difference if you apply that to the window (as shown) or the root element of your xml layout.)
Nav bar is gone. (User can swipe it up; it goes away again after a few seconds.) All good.
Status bar is still there. Status bar is a gray, white writing. All good.
Your layout still begins just below the status bar. All good.
Three: Add this flag
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
You now have four flags.
(Aside: using windowFullscreen in Theme appears to do nothing. So add that flag.)
Naturally set your layout xml to fitsSystemWindows false.
Your layout now starts at the top of the glass - it's correctly behind the (gray) status bar. You can still see the (gray) status bar. All good so far.
Four: Theme, add
<item name="android:statusBarColor">#color/white</item>
it correctly goes pink. The status text is white - you can read it.
so try
<item name="android:statusBarColor">#android:color/transparent</item>
bingo! Your app is behind the status text.
BUT...
the status text is white, you likely can't see it. (Unless your app is dark there.)
How to make the text dark ?!
This is supposed to do it:
<item name="android:windowLightStatusBar">true</item>
But it does not! It does nothing.
Does anyone know how the heck to solve this problem?
Make the status bar text black.
Every ordinary app out there, the browser etc, has black status bar text on white/clear. How to??

Related

Make NavigationBar completely transparent

I need the NavigationBar to display only the navigation bar strip.
To do this, I added the following to themes.xml
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
But this is not enough, since my NavigationBar has a translucent backgraund, to fix this, I found this code.
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
And in a sense it worked, but everything disappeared for me, including the navigation bar strip. How can I implement what I want?
It is necessary that only the strip is displayed on top of the activity, without background.

how to change color primary text , and color navigation

How to change the color of dial . Pay attention not color primary variant , and how to change the color on of button of navigation , not navigation bar color .
from this picture
enter image description here
to that picture
enter image description here
sorry for bad english, I'm from Ukraine
the text has changed but the navigation buttons no i found a better solution via xml for text
<item name="android:windowLightStatusBar">true</item>
all that remains is to change the navigation buttons, not their background
but still thank you this answer helped a lot
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); will change the color of the icons .. however if you want to support the dark theme you would need decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

How to set status bar tint color in layout/style XML?

I'm using the windowTranslucentStatus in my app theme.
Now, also want to tint the status bar to match my ActionBar.
Currently I'm using the SystemBarTint library, which is mostly fine except of one problem:
When the application launches, the OS shows a themed mockup layout as a splash image during the actual inflation. At that stage, there is no status bar tinting yet.
It looks like that (Took me 5 times to capture this screenshot during app launch):
Only after the activity is fully loaded the tint is applied. This is a problem for me and I'm looking for a way to somehow show the full branding on the status bar during launch.
I have read This blog post Which explains how you can actually control what will be displayed during launch by specifying a windowBackground.
I set the windowBackground to my main color -> then the entire screen painted pink.
I set background property on my activity's root element to white, but then again during launch the screen is pink, and only after the activity is loaded the content's background clears to white. This OK but not ideal.
I know I can create a bitmap with a white background and a color where the status bar should be, but then it won't be theme-able, meaning I'll have to create a new bitmap if the main color changes.
So to sum it up my question is this: Do you know a way to set a tint color for the status bar (in KitKat) in XML?
Alternatively, is it possible to create an XML drawable that will contain a colored bar at the top with a fixed height?
Here it is:
The (almost) perfect answer
Good to know that someone else was struggling the exact same problem like me.
To make it simple I'll post here the XML drawable:
window_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/status_bar_background"
android:drawable="#color/main_app_color"/>
<item android:id="#+id/content_window_background"
android:drawable="#color/white"
android:top="25dp"/>
</layer-list>
And now in my theme I assign this drawable as the windowBackground:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="BaseAppTheme">
<!-- Customize your theme here. -->
<item name="android:windowTranslucentNavigation">#bool/translucent_nav_bar</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowBackground">#drawable/window_background</item>
</style>
</resources>
As I have replied here, you can see a full working example I created here (unfortunately too long to copy, but rest assured that repo is going nowhere!).
Oh and from Lollipop onwards there won't be any need for tricks ;)

Android More menu text is not readable (black text on black background?)

I have a menu in my Android app that holds more than 6 items (7 items), and therefore Android automatically adds a 'More' item as the last item. When I click on 'More' item I get a new menu that holds my 6th and 7th items. But, the text is not visible.
The image is from my emulator, Android 2.3.3, but same appears on my physical phones too, Sony Ericsson X10i and Samsung Galaxy S3.
This is how the theme is set in styles.xml:
<style name="SespActivityTheme" parent="android:Theme.Light.NoTitleBar">
<item name="android:orientation">vertical</item>
<item name="android:windowSoftInputMode">stateHidden</item>
</style>
I have tried to change the theme of the app to both Light and Dark theme, but no result. I have tried to google this, without finding anyone with the same problem.
Other from this style I haven't tried to change any colors of text or icons.
I get same kind of error in the menu that appeasrs if I long press on a text box, but then it is all white instead of black:
Any ideas why this is?
I found the problem! The following lines makes this strange error:
<item name="android:orientation">vertical</item>
I cannot explain why, but if I remove this line from my style and place it in all activity XMLs then I can read the text again.

ActionSherlockBar Styling - PopupMenu

Styling is a place for improvement in my knowledge of the android platform. Given I've being trying to make a simple change all morning and been unable to achieve it.
I want to change the style of the overflow menu in the action bar. I have been able to change the background color, and add animations, so that when clicked it fades to a selected colour. But for the life of me I cannot change the text colour.
Below are two screenshots, one using the Theme.Sherlock and the other using Theme.Sherlock.Light.
Theme.Sherlock - This is my current setting which I have customised. What I want is the overflow (aka android:popupmenu) to be in the holo theme (as below), and ideally so that I can change the text colour.
Theme.Sherlock.Light - This theme shows the style of overflow menu that I want to see. However, as highlighted in red, the overflow button is the wrong colour, and this theme also draws a horizontal line.
I don't know whether it is best/easier to change Theme.Sherlock with the popup issue, or Theme.Sherlock.Light with the overflow icon and line issue. The application is of a "Light" theme so option two is probably the long term better choice, however i'll accept an answer that can solve the problem by changing either theme.
p.s. Where do you find a list of attributes for changing theme/styles, auto-complete is very incomplete in eclipse.
Update
This is actually an update for native action bars as im back to the same problem, but no longer supporting 2.3 or below.
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:actionOverflowButtonStyle">#style/OverFlow</item>
</style>
<style name="OverFlow" parent="#android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:src">**Insert your icon here**</item>
</style>
This answer is probably coming too late, but to those who may stumble across this question. I find it interesting that you were able to change the overflow's background color. I found that extremely difficult to figure out whereas changing the text was pretty straight forward. Just override the android:itemTextAppearance value in your custom theme.
<item name="android:itemTextAppearance">#style/your_new_text_appearance</item>
<style name="your_new_text_appearance">
<item name="android:textColor">#color/red</item>
</style>
I'm not familiar with ActionBarSherlock, but you can find the standard OverFlow icons on your harddisk in the folder
path\to\android\android-sdk\platforms\android-api-level\data\res\drawable-resolution
and they are called ic_menu_moreoverflow_normal_holo_dark.pngand ic_menu_moreoverflow_normal_holo_light.png
Alternatively you can find them online here.
I believe that the left circle is a drawable, too. Look inside the res\drawable.
Simple do the following:
1. In the theme.xml in your app theme style add this item:
<item name="popupMenuStyle">#style/PopupMenu</item>
2. In styles.xml add this new style:
<style name="PopupMenu" parent="#style/Widget.Sherlock.Light.ListPopupWindow">
<item name="android:textSize">14sp</item>
</style>
In the style you may override text size or other parameters as you want.
Try to override style of Theme.Sherlock with help of Android Action Bar Style Generator

Categories

Resources