v21-theme
<style name="LayoutFullScreen" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/transparent</item>
</style>
以上设置无效。
需要在代码里修改
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
}
若Layout里有
CoordinatorLayout,AppBarLayout,CollapsingToolbarLayout
每个View需要设置
android:fitsSystemWindows="true"
android:layout_height="match_parent"