In my case, I used a custom WebView like ExpandableHeightWebView for dynamic height.
@Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (isExpanded()) { int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); ViewGroup.LayoutParams params = getLayoutParams(); params.height = getMeasuredHeight(); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } }
I call setExpanded(true); after myWebView.loadData(data,null);
This problem is resolved when I delete the line setExpanded(true); .
Mustafa ferhan
source share