Is there a way to fetch an activity's WindowInsets
at will, long past the activity's creation, without holding on to it or otherwise caching it?
eg.
WindowInsets insets = getWindow().getWindowInsets();
myUseCaseView.setPaddingTop(insets.getSystemWindowInsetTop);
android.view.WindowInsets. Describes a set of insets for window content. WindowInsets are immutable and may be expanded to include more inset types in the future. To adjust insets, use one of the supplied clone methods to obtain a new WindowInsets instance with the adjusted properties.
WindowInsets are insets (or sizes) of system views (e.g. status bar, navigation bar), that are applied to the window of your application. The best way to understand something — is to see it in example.
Yes: getWindow().getDecorView().
getRootWindowInsets()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With