I finally solve of this by this line.
webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
By default, the WebSettings.LayoutAlgorithm
is NARROW_COLUMNS
.
By study the android.webkit.ZoomManager
class, it must reflow (rearrange) if NARROW_COLUMNS
and the else case is reflow if necessary. I don't know what the "necessary" is but as least it won't reflow anymore in my case.
There is some off-topic but my goal is to prevent content reflow. I found out that on Android 2.x device, sometime, the web page content would reflow if I click the zoomControl button even though set webView.getSettings().setUseWideViewPort(true);
.On Android 4, this problem is not exist.
If I am not mistaken. I think it is the web page meta tag cause this. Therefore, I make sure the web page don't have this line:<meta name="viewport" content="width=device-width">
.And I really can see the different that without this line, the web content do not reflow.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…