This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new b91144c0 fix: webview loses scrollability and creates empty bottom
space (#1924)
b91144c0 is described below
commit b91144c0d4d19663bbd94ec4db0aea25da24c2bf
Author: Gabriel Moré Maia <[email protected]>
AuthorDate: Tue May 19 11:20:41 2026 -0300
fix: webview loses scrollability and creates empty bottom space (#1924)
Co-authored-by: Gabriel Moré Maia <[email protected]>
Co-authored-by: Manuel Beck <[email protected]>
---
framework/src/org/apache/cordova/CordovaActivity.java | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java
b/framework/src/org/apache/cordova/CordovaActivity.java
index 83e58bf4..a8d4379e 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -225,13 +225,22 @@ public class CordovaActivity extends AppCompatActivity {
boolean isStatusBarVisible = statusBarView.getVisibility() !=
View.GONE;
int top = isStatusBarVisible && !canEdgeToEdge && !isFullScreen ?
bars.top : 0;
- int bottom = !canEdgeToEdge && !isFullScreen ? bars.bottom : 0;
int left = !canEdgeToEdge && !isFullScreen ? bars.left : 0;
int right = !canEdgeToEdge && !isFullScreen ? bars.right : 0;
+ Insets imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime());
+ // When in fullscreen mode, we ignore bottom system insets (like
the navigation bar)
+ // to allow the WebView to span the entire screen and avoid being
pushed up.
+ int bottom = isFullScreen ? 0 : canEdgeToEdge ? imeInsets.bottom :
Math.max(bars.bottom, imeInsets.bottom);
+
FrameLayout.LayoutParams webViewParams =
(FrameLayout.LayoutParams) webView.getLayoutParams();
- webViewParams.setMargins(left, top, right, bottom);
- webView.setLayoutParams(webViewParams);
+ // Only update layout margins if the values have actually changed.
+ // This prevents redundant layout passes and potential infinite
layout loops
+ if (webViewParams.leftMargin != left || webViewParams.topMargin !=
top
+ || webViewParams.rightMargin != right ||
webViewParams.bottomMargin != bottom) {
+ webViewParams.setMargins(left, top, right, bottom);
+ webView.setLayoutParams(webViewParams);
+ }
FrameLayout.LayoutParams statusBarParams = new
FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]