We are having an application with three activities.
1) startup Activity which doesn't have any actionbar or navigation drawer (splash)
2) Main Activity with action bar
3) Another Activity with action bar
The theme is Theme.AppCompat.Light.NoActionBar
We are facing a strange issue on lollipop phone that white space is shown in notification area without any icons (completely blank) in startup activity and other activity. No issue on Kitkat or earlier phones.
Also, this problem is not encountered with MainActivity having Actionbar and navagation drawer
Any idea what could be wrong? will be happy to provide more details if requires.
You can see screenshot: http://imgur.com/1K9LbWi
This was the issue which somehow went into values-v21/styles.xml, removing it solved. Thanks all of you for answering.
<item name="android:navigationBarColor">#color/myNavigationColor</item>
Your status bar is in white color so you can not see any notification icon. Please change your status bar color with style.xml.
Open your style.xml and change color of colorPrimaryDark attribute.
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
Related
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.
I make an Android application trying to support Android Lollipop and previous versions. So, I use Theme.AppCompat.Light for my app.
In Android 4.4, Action Bar title is white like I want and preferences screen titles are blacks.
In Android 5.0, Action Bar title is black by default and preferences screen titles are blacks. But, I want my Action Bar title be white on all versions of Android so I used the following customization in my theme for v21 :
<item name="android:textColorPrimary">#android:color/white</item>
With this customization, Action Bar title is white like i want but it seems that preferences screen title are also linked to android:textColorPrimary in Android 5.0 .
So, my question is the following. Is there a solution to create an Action Bar title with white title and in the same time have preferences screen title with other color like black?
Just make two styles.
One with:
<item name="android:textColorPrimary">#android:color/white</item>
One with:
<item name="android:textColorPrimary">#android:color/black</item>
Set your activities with action bars to the white one.
Set you preference activity to the black one.
In my android app, in the Action Bar, next to the < image is an icon. I want to make it invisible/gone ondemand dynamically. How do I do that? The icon is actually defined as follows (this should help you realize where in the action bar I am talking about).
<style name="MyAppName.LogoTheme.LogoActionBar" parent="MyAppName.Theme.ActionBar">
<item name="android:displayOptions">showHome|homeAsUp</item>
<item name="android:icon">#drawable/my_icon</item>
I tried the following, but nothing.
this.getActionBar().setDisplayHomeAsUpEnabled(false);
this.getActionBar().setLogo(null);
this.getActionBar().setDisplayUseLogoEnabled(true);
In Java, call setDisplayShowHomeEnabled(false) and setDisplayShowTitleEnabled(false) on your ActionBar.
I am using Action Bar Sherlock for compatibility with earlier versions of Android. My objective is to not display the app title in the action bar, but to show a logo on the left and a couple of action buttons on the right. In my styles, I am using these options for the action bar:
<style name="MyActionBarStyle" parent="Sherlock.__Widget.ActionBar">
<item name="background">#drawable/toolbar</item>
<item name="displayOptions">showHome|useLogo</item>
<item name="android:background">#drawable/toolbar</item>
<item name="android:displayOptions">showHome|useLogo</item>
</style>
Everything works as hoped for on Android 2.3. On my Android 4.0.4 test phone, however, the action bar takes up the entire screen, with the app logo on the left, the action buttons on the right, but these are all centered vertically on the screen instead of residing at the top. The gradient for the toolbar, which is actually a very small pic dimensionally, occupies the entire screen (besides the status bar). The rest of the activity below the action bar is not visible.
If I remove showHome from the displayOptions above, the action bar no longer takes up the whole screen. But my logo is now gone. What do I need to do to get this working properly for Android 4?
Thanks in advance for any help.
I determined that this issue is not a problem with ActionBarSherlock, just with Android 4 in general. There seems to be a combination of options that causes this behavior to happen. I couldn't find a satisfactory solution with styles but was able to get the desired behavior in code.
I use action bar in my app (actionbarsherlock) and I wanted I wanted the title not to be shown but just wiew the logo in ab. So I tried to use
<item name="abDisplayOptions">useLogo</item>
Yes, the title disappeared, but the logo isn't shown anymore. Why? And how can I solve it using just XML?
Ok. I've solved this problem by
<item name="abIcon">#drawable/logo</item>
and then
<item name="abDisplayOptions">showHome</item>
But I do not understand why it didn't work with abLogo.