App with white toolbar and dark text

Viewed 1701

I have been trying to achieve this in a project with minSDK 16 :

Actionbar and statusbar in White color with dark text and icons.

Like this:

enter image description here

I have been trying to figure this out for ages now. Google searches lead to a lot of answers that dont make any sense and/or dont support older api's. colorControlNormal, titleTextColor, Appcompat-this, Appcompat-that... its a nightmare!

I am also not able to find any docs on what items to put in my styles xml, and none of the combinations of style properties I tried seem to have any effect whatsoever.

So can someone please give me a proper and well explained walkthrough as to how I can acheive this effect?

Thanks.

3 Answers

you can try with that

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:statusBarColor">@color/white</item>
    <item name="android:windowLightStatusBar">true</item>
</style>

but API min is 23.

Also, don't forget to use different styles for different versions of APIs so far I haven't found an app that works as you want, so most probably isn't possible.

Add these to your Base Application Theme in styles.xml

<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>

And add following attribute to your parent layout:

android:fitsSystemWindows=”true”

You can customize your toolbar with custom view as follows:

Create your view inside toolbar and use in you code as you want

XML:

<android.support.v7.widget.Toolbar>
      
</android.support.v7.widget.Toolbar>

Java:

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

This will help you

Related