Limit WebView height

pull/209/head
M66B 2 years ago
parent 7f83e2912d
commit c2a53562e0

@ -245,13 +245,15 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 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);
if (legacy) { if (legacy) {
if (height > getMinimumHeight()) if (height > getMinimumHeight())
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST)); super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
else else
super.onMeasure(widthMeasureSpec, heightMeasureSpec); // Unspecified super.onMeasure(widthMeasureSpec, limitHeight);
} else { } else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec); super.onMeasure(widthMeasureSpec, limitHeight);
} }
int mh = getMeasuredHeight(); int mh = getMeasuredHeight();

Loading…
Cancel
Save