I am trying out AppCompat on Marshmallow. And I want to have a transparent status bar however it turns white. I\'ve tried a couple solutions but they didn\'t work for me (Tr
This has work to me
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
Just remove following tag from style v21 @android:color/transparent
This works for me.
I have found solution for this -
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowLightStatusBar">true</item>
</style>
add this into your style and it will work for api 21 or above.
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
</style
Just Replace this , statusBarColor should be your expected color and not TRANSPARENT
I fixed my issue by changing my Activity layout from FrameLayout to RelativeLayout. Thanks everybody who tried to help!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/theme_primary_dark"
android:fitsSystemWindows="true" />
</RelativeLayout>
Try hierarchy-viewer or ViewInspector. These tools might help you.
Check this Toolbar turns white - AppBar isn't drawn after being scrolled off screen
https://code.google.com/p/android/issues/detail?id=178037#c19
I'm using libraries 23.0.0. and the bug still occurs.
Workaround for this is adding View that takes nearly no space and can be invisible. See the structure below.
<android.support.v4.widget.NestedScrollView
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.AppBarLayout>
<android.support.v7.widget.Toolbar
app:layout_scrollFlags="scroll|enterAlways" />
<android.support.design.widget.TabLayout
app:layout_scrollFlags="scroll|enterAlways" />
<View
android:layout_width="match_parent"
android:layout_height=".3dp"
android:visibility="visible"/>
</android.support.design.widget.AppBarLayout>
This Questions on Stackoverflow.com refer to this bug too: CoordinatorLayout Toolbar invisible on enter until full height AppBarLayout - Layout sometimes invisible once it enters view (even if it's not entered)