Hello,
I want to set the status bar background color to completely transparent. But i can't change it stays half transparent (black), i just can't change it.
I tried set them in my theme
<style name="AppThemeMeterialCompat" parent="MaterialDrawerTheme.Light.DarkToolbar.TranslucentStatus">
<item name="colorPrimaryDark">@android:color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
and them in the builder
.withTranslucentStatusBar(true)
.withFullscreen(true)
Please help
@buraktamturk what phone do you use?
Have you tried only withFullscreen?
The thing is that this is managed by Android and it's really hard to get it full transparent.
If you want to manage everything on your own and just need the DrawerLayout content. then use the.buildView() method this will give you the contentView which can be inflated inside the DrawerLayout
I am using Nexus 5 with Android ver 5.1.
Now tried with only withFullscreen and withFullscreen and without customization in Theme, same thing happens.
I think this commit seems like should've solved my issue. I am not sure the if bellow this comment
//if we are fullscreen disable the ScrimInsetsLayout
is triggered or not
Edit: commit https://github.com/mikepenz/MaterialDrawer/commit/c2707aa2e56751b184e48f5128318dd8f07f7c42
@buraktamturk you can achieve this by doing following:
@Override
protected void onCreate(Bundle savedInstanceState) {
...
//make full transparent statusBar
if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, true);
}
if (Build.VERSION.SDK_INT >= 19) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
if (Build.VERSION.SDK_INT >= 21) {
setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
}
public static void setWindowFlag(Activity activity, final int bits, boolean on) {
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
Thank you so much! It worked!
@buraktamturk no problem :P
This doesnt work on the initial activity if the theme is Theme.Translucent.NoTitlebar
Thanks buddy is Its working
its work thanxz and i want to change my statusbar icon color.is it possile. mikepenz
@mikepenz Thank you for the answer :), but I'm having difficulty understanding what happens here. Can you please explain what happens, especially
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
and or's in here. I don't quite get them why do we use them?
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
@pesjak this answer is outdated. please see the sample app for various implementations, including one with a fullscreen behavior.
the flags are btw. plain android here. and the "|" and so on are binary operations
For the fullscreen, I've found https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/FullscreenDrawerActivity.java, and you have it commented. But the result isn't the one that i want :/. I've been looking at the sample app but can't find the same result. This is the result that the commented code gives https://i.stack.imgur.com/oq38g.png which is the excatcly what I want 💃.
Do you maybe know what is the updated answer if it isn't too much trouble, because I can't find it :(
if it works for you with the commented code then use it.
This stuff is basically not relevant to the library.
The library uses a normal DrawerLayout and the sample just showcases a view different cases.
everything which you can achieve with a normal DrawerLayout can be done with this library.
The relevant things should still be looked up on the android docs or alternative sources.
Thank you so much :) for the help.
Kind regards, Primoz
On Mon, 8 Oct 2018, 19:07 Mike Penz, notifications@github.com wrote:
if it works for you with the commented code then use it.
This stuff is basically not relevant to the library.The library uses a normal DrawerLayout and the sample just showcases a
view different cases.everything which you can achieve with a normal DrawerLayout can be done
with this library.The relevant things should still be looked up on the android docs or
alternative sources.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mikepenz/MaterialDrawer/issues/254#issuecomment-427910073,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG44ygAITvqnJ00xNXLuURwvijLHfKwvks5ui4ZjgaJpZM4EHL2_
.
Not working for me having API 19 in my case not working this code
public static void setWindowFlag(Activity activity, final int bits, boolean on) {
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
help me
Most helpful comment
@buraktamturk you can achieve this by doing following: