Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

White navigationbar with grey icons

How can I get this style in my android app? White navigationbar and grey icons. An example is when opening the application drawer. enter image description here

I have tried many options but without success. the application minSdkVersion is 21, lollipop.

I have seen this solution, but I have not managed to apply it:

Status bar turns white and does not show content behind it

like image 339
Sergio76 Avatar asked Mar 13 '18 11:03

Sergio76


2 Answers

For API >= 23

Try :

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); 

OR in style :

<item name="android:windowLightStatusBar">true</item>
<item name="colorPrimary">@color/colorWhite</item>
<item name="colorPrimaryDark">#colorPrimaryDak</item>
<item name="colorAccent">@color/colorAccent</item>

For API < 23

Declare this under v21/style.

<item name="colorPrimaryDark" tools:targetApi="23">@color/colorPrimary</item> // white
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>

UPDATE :

<item name="colorPrimaryDark">@color/colorPrimary</item> // white
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
like image 50
Vidhi Dave Avatar answered Oct 10 '22 15:10

Vidhi Dave


You just can't. It's not provided for API 21-22 it's.

However you can make it black:

getWindow().setStatusBarColor(Color.BLACK);

Full Example:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_activity);

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
            getWindow().setStatusBarColor(Color.BLACK);
        }

    }
}
like image 24
Mopto Avatar answered Oct 10 '22 15:10

Mopto