Skip to content

Instantly share code, notes, and snippets.

@JetXing
Created April 16, 2015 07:49
Show Gist options
  • Save JetXing/51313aaf2c4d06f14610 to your computer and use it in GitHub Desktop.
Save JetXing/51313aaf2c4d06f14610 to your computer and use it in GitHub Desktop.
Immersive Mode(沉浸式) ,设置view的padding
protected final void initStatusBar(int resId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setTintResource(R.color.your_color);
SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
findViewById(resId).setPadding(0, config.getPixelInsetTop(true), 0, config.getPixelInsetBottom());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment