I have SingleFramgnetActivity whose purpose is only to hold and replace fragments inside it.
layout looks like this:
Your FrameLayout is not aware of window inset sizes, because it's parent - LinearLayout hasn't dispatched him any. As a workaround, you can subclass LinearLayout and pass insets to children on your own:
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
int childCount = getChildCount();
for (int index = 0; index < childCount; index++)
getChildAt(index).dispatchApplyWindowInsets(insets); // let children know about WindowInsets
return insets;
}
You can have a look to my this answer, which will explain detailed how this works, and also how to use ViewCompat.setOnApplyWindowInsetsListener API.