From da4efb1a15a625d960a214187b692a11ddb13da4 Mon Sep 17 00:00:00 2001 From: jkds Date: Sat, 30 Nov 2024 11:23:42 +0100 Subject: [PATCH] when the IME is shown, it covers the systemBars at the bottom. So we just use the IME height for the bottom padding. --- java/MainActivity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/MainActivity.java b/java/MainActivity.java index 6fa2c096..44da152d 100644 --- a/java/MainActivity.java +++ b/java/MainActivity.java @@ -210,13 +210,18 @@ public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { Insets imeInsets = insets.getInsets(WindowInsets.Type.ime()); Insets sysInsets = insets.getInsets(WindowInsets.Type.systemBars()); + int bottomPadding = sysInsets.bottom; + if (imeInsets.bottom > 0) { + bottomPadding = imeInsets.bottom; + } + // The sys insets change when orientation changes and sys bars // change position. v.setPadding( sysInsets.left, sysInsets.top, sysInsets.right, - imeInsets.bottom + sysInsets.bottom + bottomPadding ); } return insets;