使用以下代码会使我的布局扩展到导航栏下方。Id只是想更改状态栏颜色而不会弄乱布局。
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP){
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
getWindow().setStatusBarColor(this.getResources().getColor(R.color.statusbar_color));
//TRANSPARENT FOR TESTING
getWindow().setNavigationBarColor(this.getResources().getColor(android.R.color.transparent));
}
Run Code Online (Sandbox Code Playgroud)
我觉得我在想什么...

更新支持库后,我试图在导航抽屉上设置阴影,但由于某种原因,没有任何效果,我很困惑。
我遇到了这个问题,但它的解决方案是仅使用 setElevation ,这对我来说也不起作用:https://code.google.com/p/android/issues/detail ?id=184434
确实没有太多代码可发布,但以下是我所说的供参考:
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP) {
mDrawerLayout.setDrawerElevation(25f);
} else {
mDrawerLayout.setDrawerShadow(R.drawable.left_drawer_shadow, GravityCompat.START);
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 ScrimInsetsFrameLayout 但这不应该导致问题 AFAIKT。
有任何想法吗?