Last active
June 2, 2018 13:58
-
-
Save nontravis/612a63dc651433215c07d90e661b7244 to your computer and use it in GitHub Desktop.
CustomLayout.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomLayout : LinearLayout { | |
... | |
@Suppress("OverridingDeprecatedMember") | |
override | |
fun fitSystemWindows(insets: Rect): Boolean { | |
// Pre API 20: do something with insets | |
return true //consume inset: not pass insets down | |
//or | |
return false //pass insets down to child view | |
} | |
@RequiresApi(Build.VERSION_CODES.KITKAT_WATCH) | |
override | |
fun onApplyWindowInsets(insets: WindowInsets): IndowInsets { | |
// do something with insets | |
return windowInsets.consumeSystemWindowInsets() //consume inset: not pass insets down | |
//or | |
return windowInsets //pass insets down to child view | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment