Respect WebView max height

This commit is contained in:
M66B
2022-06-13 11:26:16 +02:00
parent eafc005367
commit ff5443c645
2 changed files with 17 additions and 10 deletions

View File

@@ -217,6 +217,12 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
settings.setBlockNetworkImage(!show_images);
}
@Override
public void setMinimumHeight(int minHeight) {
super.setMinimumHeight(minHeight);
Log.i("Set min height=" + minHeight);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (legacy) {
@@ -230,6 +236,8 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
int mh = getMeasuredHeight();
Log.i("Measured height=" + mh + " last=" + height + "/" + maxHeight + " ch=" + getContentHeight());
if (mh > maxHeight)
setMeasuredDimension(getMeasuredWidth(), maxHeight);
if (mh == 0 && legacy)
setMeasuredDimension(getMeasuredWidth(), height);
}