Limit WebView height to screen height

This commit is contained in:
M66B 2022-11-19 11:23:47 +01:00
parent ae09611a2c
commit 46583b0f91
1 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
@ -246,7 +247,8 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Unable to create layer for WebViewEx, size 1088x16384 max size 16383 color type 4 has context 1)
int limitHeight = MeasureSpec.makeMeasureSpec(16000, MeasureSpec.AT_MOST);
int h = Resources.getSystem().getDisplayMetrics().heightPixels;
int limitHeight = MeasureSpec.makeMeasureSpec(h, MeasureSpec.AT_MOST);
if (legacy) {
if (height > getMinimumHeight())
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));