Hey ich will meine statusbar Farbe ändern ich dies in meiner styles.xml
und v21/styles.xml gesetzt:Wie die Statusfarbe ändern
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorPrimary">@color/colorPrimaryText</item>
<item name="android:windowBackground">@color/windowBackground</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowActionBarOverlay">false</item>
</style>
und in meiner Haupttätigkeit dieses:
Toolbar myToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(myToolbar);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setElevation(0);
getSupportActionBar().getThemedContext();
Window window = this.getWindow();
// clear FLAG_TRANSLUCENT_STATUS flag:
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// finally change the color
window.setStatusBarColor(this.getResources().getColor(R.color.colorPrimaryDark));
aber es dosent Arbeit ... kann jemand helfen? Ich benutze AppCompact
in meinem mainAcitvity
auf dem hilft Gerät, das Sie testen ?? –
Ich Test auf einem Huawei mit der Android-Version 5.1.1 – developKinberg
@developKinberg siehe meine Antwort unten. –