Issue
Anyone know how to get rid of this automatic tint when you use windowTranslucentStatus = true? I already have status bar colour set to transparent but when I enable windowTranslucentStatus, it seems to override that. If I disable windowTranslucentStatus, then I get the desired status bar colour but I can no longer draw the nav drawer under the status bar. I was able to achieve what I wanted using ScrimInsetFrameLayout but that has caused other problems.
Solution
If you enable FLAG_TRANSLUCENT_STATUS
you can draw under the status bar because it automatically set two other system UI visibility flags as explained in the documentation:
public static final int FLAG_TRANSLUCENT_STATUS
When this flag is enabled for a window, it automatically sets the system UI visibility flags SYSTEM_UI_FLAG_LAYOUT_STABLE and SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN.
Since you want to only use setStatusBarColor
you need to set manually those flags:
int flag = window.getDecorView().getSystemUiVisibility();
window.getDecorView().setSystemUiVisibility( flag | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
window.setStatusBarColor(context.getResources().getColor(R.color.yourcolor));
Answered By - Mattia Maestrini
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.