Draw content under both status bar and navbar while maintaining fitsSystemWindows=“true” behaviour
up vote
0
down vote
favorite
I'm trying to draw content under both status bar and navigation bar with them being completely transparent while also taking advantage of fitsSystemWindows="true".
For the status bar, fitsSystemWindows="true" along with the following code works fine.
getWindow() .getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
getWindow().setStatusBarColor(Color.TRANSPARENT);

However, when I add the following line to draw content under the navigation bar, the insets that we get from fitsSystemWindows="true" are no longer available.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Some solutions include obtaining the statusbar and navigation bar heights like so
getResources().getDimensionPixelSize(getResources().getIdentifier("status_bar_height", "dimen", "android"));
and using it as padding.
However, this method is discouraged.
Is there any way to maintain the behaviour of fitsSystemWindows="true" while drawing content under both the status bar and the navigation bar? Thanks in advance.
add a comment |
up vote
0
down vote
favorite
I'm trying to draw content under both status bar and navigation bar with them being completely transparent while also taking advantage of fitsSystemWindows="true".
For the status bar, fitsSystemWindows="true" along with the following code works fine.
getWindow() .getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
getWindow().setStatusBarColor(Color.TRANSPARENT);

However, when I add the following line to draw content under the navigation bar, the insets that we get from fitsSystemWindows="true" are no longer available.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Some solutions include obtaining the statusbar and navigation bar heights like so
getResources().getDimensionPixelSize(getResources().getIdentifier("status_bar_height", "dimen", "android"));
and using it as padding.
However, this method is discouraged.
Is there any way to maintain the behaviour of fitsSystemWindows="true" while drawing content under both the status bar and the navigation bar? Thanks in advance.
Can you just draw an illustration so that it can be clear
– Sai Jayant
15 hours ago
@SaiJayant I have included screenshots. As you can see, in the first screenshot, the AppBar and the rest of the content is properly laid out with the appropriate insets provided by fitsSystemWindows="true". In the second secreenshot, the insets disappear. Thanks for your time.
– DavidH
15 hours ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to draw content under both status bar and navigation bar with them being completely transparent while also taking advantage of fitsSystemWindows="true".
For the status bar, fitsSystemWindows="true" along with the following code works fine.
getWindow() .getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
getWindow().setStatusBarColor(Color.TRANSPARENT);

However, when I add the following line to draw content under the navigation bar, the insets that we get from fitsSystemWindows="true" are no longer available.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Some solutions include obtaining the statusbar and navigation bar heights like so
getResources().getDimensionPixelSize(getResources().getIdentifier("status_bar_height", "dimen", "android"));
and using it as padding.
However, this method is discouraged.
Is there any way to maintain the behaviour of fitsSystemWindows="true" while drawing content under both the status bar and the navigation bar? Thanks in advance.
I'm trying to draw content under both status bar and navigation bar with them being completely transparent while also taking advantage of fitsSystemWindows="true".
For the status bar, fitsSystemWindows="true" along with the following code works fine.
getWindow() .getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
getWindow().setStatusBarColor(Color.TRANSPARENT);

However, when I add the following line to draw content under the navigation bar, the insets that we get from fitsSystemWindows="true" are no longer available.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Some solutions include obtaining the statusbar and navigation bar heights like so
getResources().getDimensionPixelSize(getResources().getIdentifier("status_bar_height", "dimen", "android"));
and using it as padding.
However, this method is discouraged.
Is there any way to maintain the behaviour of fitsSystemWindows="true" while drawing content under both the status bar and the navigation bar? Thanks in advance.
edited 15 hours ago
asked 16 hours ago
DavidH
1,5191025
1,5191025
Can you just draw an illustration so that it can be clear
– Sai Jayant
15 hours ago
@SaiJayant I have included screenshots. As you can see, in the first screenshot, the AppBar and the rest of the content is properly laid out with the appropriate insets provided by fitsSystemWindows="true". In the second secreenshot, the insets disappear. Thanks for your time.
– DavidH
15 hours ago
add a comment |
Can you just draw an illustration so that it can be clear
– Sai Jayant
15 hours ago
@SaiJayant I have included screenshots. As you can see, in the first screenshot, the AppBar and the rest of the content is properly laid out with the appropriate insets provided by fitsSystemWindows="true". In the second secreenshot, the insets disappear. Thanks for your time.
– DavidH
15 hours ago
Can you just draw an illustration so that it can be clear
– Sai Jayant
15 hours ago
Can you just draw an illustration so that it can be clear
– Sai Jayant
15 hours ago
@SaiJayant I have included screenshots. As you can see, in the first screenshot, the AppBar and the rest of the content is properly laid out with the appropriate insets provided by fitsSystemWindows="true". In the second secreenshot, the insets disappear. Thanks for your time.
– DavidH
15 hours ago
@SaiJayant I have included screenshots. As you can see, in the first screenshot, the AppBar and the rest of the content is properly laid out with the appropriate insets provided by fitsSystemWindows="true". In the second secreenshot, the insets disappear. Thanks for your time.
– DavidH
15 hours ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Use the flag
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
Then push your view using these two methods
@SuppressLint("NewApi")
public static boolean hasImmersive(Context ctx) {
if (!cached) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
hasImmersive = false;
cached = true;
return false;
}
Display d = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
d.getRealMetrics(realDisplayMetrics);
int realHeight = realDisplayMetrics.heightPixels;
int realWidth = realDisplayMetrics.widthPixels;
DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
int displayHeight = displayMetrics.heightPixels;
int displayWidth = displayMetrics.widthPixels;
hasImmersive = (realWidth > displayWidth) || (realHeight > displayHeight);
cached = true;
}
return hasImmersive;
}
Apply padding accordingly
if (hasImmersive(this)) {
yourView.setPadding(0, 0, 0, getSoftButtonsBarHeight());
}
And get the height of System soft button
@SuppressLint("NewApi")
private int getSoftButtonsBarHeight() {
// getRealMetrics is only available with API 17 and +
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int usableHeight = metrics.heightPixels;
getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
int realHeight = metrics.heightPixels;
if (realHeight > usableHeight)
return realHeight - usableHeight;
else
return 0;
}
return 0;
}
Screenshots

EDIT: To preserve the fitsSystemWindows="true" behaviour for the notification bar, add the FLAG_LAYOUT_NO_LIMITS and other flags after the window insets have been applied to your View which has fitsSystemWindows set to true. This will ensure that the insets have been applied normally before applying the no-limit flag.
yourViewWithFitsSystemWindows.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if(insets.getSystemWindowInsetTop() == 0) return insets; // This is needed.
v.onApplyWindowInsets(insets);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
// add other flags
return insets;
}
});
This, along with setting the bottom padding, gives the desired result.
Thanks. This works for the navigation bar. If we could also account for the notification bar inset too, then this answer would be complete. Do you have anything for that?
– DavidH
14 hours ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Use the flag
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
Then push your view using these two methods
@SuppressLint("NewApi")
public static boolean hasImmersive(Context ctx) {
if (!cached) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
hasImmersive = false;
cached = true;
return false;
}
Display d = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
d.getRealMetrics(realDisplayMetrics);
int realHeight = realDisplayMetrics.heightPixels;
int realWidth = realDisplayMetrics.widthPixels;
DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
int displayHeight = displayMetrics.heightPixels;
int displayWidth = displayMetrics.widthPixels;
hasImmersive = (realWidth > displayWidth) || (realHeight > displayHeight);
cached = true;
}
return hasImmersive;
}
Apply padding accordingly
if (hasImmersive(this)) {
yourView.setPadding(0, 0, 0, getSoftButtonsBarHeight());
}
And get the height of System soft button
@SuppressLint("NewApi")
private int getSoftButtonsBarHeight() {
// getRealMetrics is only available with API 17 and +
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int usableHeight = metrics.heightPixels;
getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
int realHeight = metrics.heightPixels;
if (realHeight > usableHeight)
return realHeight - usableHeight;
else
return 0;
}
return 0;
}
Screenshots

EDIT: To preserve the fitsSystemWindows="true" behaviour for the notification bar, add the FLAG_LAYOUT_NO_LIMITS and other flags after the window insets have been applied to your View which has fitsSystemWindows set to true. This will ensure that the insets have been applied normally before applying the no-limit flag.
yourViewWithFitsSystemWindows.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if(insets.getSystemWindowInsetTop() == 0) return insets; // This is needed.
v.onApplyWindowInsets(insets);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
// add other flags
return insets;
}
});
This, along with setting the bottom padding, gives the desired result.
Thanks. This works for the navigation bar. If we could also account for the notification bar inset too, then this answer would be complete. Do you have anything for that?
– DavidH
14 hours ago
add a comment |
up vote
1
down vote
accepted
Use the flag
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
Then push your view using these two methods
@SuppressLint("NewApi")
public static boolean hasImmersive(Context ctx) {
if (!cached) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
hasImmersive = false;
cached = true;
return false;
}
Display d = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
d.getRealMetrics(realDisplayMetrics);
int realHeight = realDisplayMetrics.heightPixels;
int realWidth = realDisplayMetrics.widthPixels;
DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
int displayHeight = displayMetrics.heightPixels;
int displayWidth = displayMetrics.widthPixels;
hasImmersive = (realWidth > displayWidth) || (realHeight > displayHeight);
cached = true;
}
return hasImmersive;
}
Apply padding accordingly
if (hasImmersive(this)) {
yourView.setPadding(0, 0, 0, getSoftButtonsBarHeight());
}
And get the height of System soft button
@SuppressLint("NewApi")
private int getSoftButtonsBarHeight() {
// getRealMetrics is only available with API 17 and +
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int usableHeight = metrics.heightPixels;
getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
int realHeight = metrics.heightPixels;
if (realHeight > usableHeight)
return realHeight - usableHeight;
else
return 0;
}
return 0;
}
Screenshots

EDIT: To preserve the fitsSystemWindows="true" behaviour for the notification bar, add the FLAG_LAYOUT_NO_LIMITS and other flags after the window insets have been applied to your View which has fitsSystemWindows set to true. This will ensure that the insets have been applied normally before applying the no-limit flag.
yourViewWithFitsSystemWindows.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if(insets.getSystemWindowInsetTop() == 0) return insets; // This is needed.
v.onApplyWindowInsets(insets);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
// add other flags
return insets;
}
});
This, along with setting the bottom padding, gives the desired result.
Thanks. This works for the navigation bar. If we could also account for the notification bar inset too, then this answer would be complete. Do you have anything for that?
– DavidH
14 hours ago
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Use the flag
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
Then push your view using these two methods
@SuppressLint("NewApi")
public static boolean hasImmersive(Context ctx) {
if (!cached) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
hasImmersive = false;
cached = true;
return false;
}
Display d = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
d.getRealMetrics(realDisplayMetrics);
int realHeight = realDisplayMetrics.heightPixels;
int realWidth = realDisplayMetrics.widthPixels;
DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
int displayHeight = displayMetrics.heightPixels;
int displayWidth = displayMetrics.widthPixels;
hasImmersive = (realWidth > displayWidth) || (realHeight > displayHeight);
cached = true;
}
return hasImmersive;
}
Apply padding accordingly
if (hasImmersive(this)) {
yourView.setPadding(0, 0, 0, getSoftButtonsBarHeight());
}
And get the height of System soft button
@SuppressLint("NewApi")
private int getSoftButtonsBarHeight() {
// getRealMetrics is only available with API 17 and +
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int usableHeight = metrics.heightPixels;
getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
int realHeight = metrics.heightPixels;
if (realHeight > usableHeight)
return realHeight - usableHeight;
else
return 0;
}
return 0;
}
Screenshots

EDIT: To preserve the fitsSystemWindows="true" behaviour for the notification bar, add the FLAG_LAYOUT_NO_LIMITS and other flags after the window insets have been applied to your View which has fitsSystemWindows set to true. This will ensure that the insets have been applied normally before applying the no-limit flag.
yourViewWithFitsSystemWindows.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if(insets.getSystemWindowInsetTop() == 0) return insets; // This is needed.
v.onApplyWindowInsets(insets);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
// add other flags
return insets;
}
});
This, along with setting the bottom padding, gives the desired result.
Use the flag
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
Then push your view using these two methods
@SuppressLint("NewApi")
public static boolean hasImmersive(Context ctx) {
if (!cached) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
hasImmersive = false;
cached = true;
return false;
}
Display d = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
d.getRealMetrics(realDisplayMetrics);
int realHeight = realDisplayMetrics.heightPixels;
int realWidth = realDisplayMetrics.widthPixels;
DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
int displayHeight = displayMetrics.heightPixels;
int displayWidth = displayMetrics.widthPixels;
hasImmersive = (realWidth > displayWidth) || (realHeight > displayHeight);
cached = true;
}
return hasImmersive;
}
Apply padding accordingly
if (hasImmersive(this)) {
yourView.setPadding(0, 0, 0, getSoftButtonsBarHeight());
}
And get the height of System soft button
@SuppressLint("NewApi")
private int getSoftButtonsBarHeight() {
// getRealMetrics is only available with API 17 and +
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int usableHeight = metrics.heightPixels;
getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
int realHeight = metrics.heightPixels;
if (realHeight > usableHeight)
return realHeight - usableHeight;
else
return 0;
}
return 0;
}
Screenshots

EDIT: To preserve the fitsSystemWindows="true" behaviour for the notification bar, add the FLAG_LAYOUT_NO_LIMITS and other flags after the window insets have been applied to your View which has fitsSystemWindows set to true. This will ensure that the insets have been applied normally before applying the no-limit flag.
yourViewWithFitsSystemWindows.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if(insets.getSystemWindowInsetTop() == 0) return insets; // This is needed.
v.onApplyWindowInsets(insets);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
// add other flags
return insets;
}
});
This, along with setting the bottom padding, gives the desired result.
edited 8 hours ago
DavidH
1,5191025
1,5191025
answered 15 hours ago
Sai Jayant
139212
139212
Thanks. This works for the navigation bar. If we could also account for the notification bar inset too, then this answer would be complete. Do you have anything for that?
– DavidH
14 hours ago
add a comment |
Thanks. This works for the navigation bar. If we could also account for the notification bar inset too, then this answer would be complete. Do you have anything for that?
– DavidH
14 hours ago
Thanks. This works for the navigation bar. If we could also account for the notification bar inset too, then this answer would be complete. Do you have anything for that?
– DavidH
14 hours ago
Thanks. This works for the navigation bar. If we could also account for the notification bar inset too, then this answer would be complete. Do you have anything for that?
– DavidH
14 hours ago
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370971%2fdraw-content-under-both-status-bar-and-navbar-while-maintaining-fitssystemwindow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you just draw an illustration so that it can be clear
– Sai Jayant
15 hours ago
@SaiJayant I have included screenshots. As you can see, in the first screenshot, the AppBar and the rest of the content is properly laid out with the appropriate insets provided by fitsSystemWindows="true". In the second secreenshot, the insets disappear. Thanks for your time.
– DavidH
15 hours ago