Skip to content

Instantly share code, notes, and snippets.

View AndroidPoet's full-sized avatar
🎯
Focusing

Ranbir Singh AndroidPoet

🎯
Focusing
View GitHub Profile
//Add these lines inside your MainActivity.
if (Build.VERSION.SDK_INT >= 30) {
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view, windowInsets ->
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
// Apply the insets as a margin to the view. Here the system is setting
// only the bottom, left, and right dimensions, but apply whichever insets are
// appropriate to your layout. You can also update the view padding
// if that's more appropriate.