Skip to content

Commit 800ba9f

Browse files
committed
Fixing issue where footer overlaps webview content on Android
1 parent bf69393 commit 800ba9f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/android/InAppBrowser.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,8 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
812812
toolbar.addView(close);
813813

814814
// Footer
815+
int footerSize = this.dpToPixels(44);
816+
815817
RelativeLayout footer = new RelativeLayout(cordova.getActivity());
816818
int _footerColor;
817819
if(footerColor != ""){
@@ -820,7 +822,7 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
820822
_footerColor = android.graphics.Color.LTGRAY;
821823
}
822824
footer.setBackgroundColor(_footerColor);
823-
RelativeLayout.LayoutParams footerLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44));
825+
RelativeLayout.LayoutParams footerLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, footerSize);
824826
footerLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
825827
footer.setLayoutParams(footerLayout);
826828
if (closeButtonCaption != "") footer.setPadding(this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8));
@@ -833,7 +835,15 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
833835

834836
// WebView
835837
inAppWebView = new WebView(cordova.getActivity());
836-
inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
838+
// inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
839+
840+
LinearLayout.LayoutParams webViewLayoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
841+
842+
if (showFooter) {
843+
webViewLayoutParams.setMargins(0, 0, 0, footerSize); // Adding margin the same size as the footer
844+
}
845+
846+
inAppWebView.setLayoutParams(webViewLayoutParams);
837847
inAppWebView.setId(Integer.valueOf(6));
838848
// File Chooser Implemented ChromeClient
839849
inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {

0 commit comments

Comments
 (0)