Skip to content

Instantly share code, notes, and snippets.

@hiking93
Created March 17, 2022 07:25
Show Gist options
  • Save hiking93/3a138f360a9d137b0bea7279a365347b to your computer and use it in GitHub Desktop.
Save hiking93/3a138f360a9d137b0bea7279a365347b to your computer and use it in GitHub Desktop.
Return consumed insets in OnApplyWindowInsetsListener#onApplyWindowInsets.
val systemBarInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
val imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime())
WindowInsetsCompat.Builder(insets)
.setInsets(
WindowInsetsCompat.Type.systemBars(),
Insets.of(0, 0, 0, systemBarInsets.bottom)
)
.setInsets(
WindowInsetsCompat.Type.ime(),
Insets.of(0, 0, 0, imeInsets.bottom)
)
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment