Should not happen: no rect-based-test nodes foundを解決

で、このエラーメッセージで検索してサクっと見つかる情報はこれ。

というか、このページで全て解決!


ここの最初の回答の最後のコメントがこれ。

I met with John Reck, an engineer on the Android WebView team, a couple of days ago. He confirmed that this is a bug--basically a race condition where the webkit layout engine gets out of sync with the Android layout and starts mapping touch events to an incorrect coordinate system. Until the bug is fixed, calling onScrollChanged() to resync the layouts seems to be the best workaround. – Ian Ni-Lewis Apr 10 at 18:05

回避策は WebView の onScrollChanged() を呼んであげること。
ただし、onScrollChanged() は protected なので、WebView を継承したクラスを作って外から呼べるメソッド作ってそこから呼ばなきゃならない。
これも例が載ってる。

public void applyAfterMoveFix() {
  onScrollChanged(getScrollX(), getScrollY(), getScrollX(), getScrollY());
}

これを WebView を貼り付けている Fragment から適切なタイミングで呼べば OK。


今回はこんな感じにしてみた。

public class MyWebView extends WebView {
    public WebViewForFragment(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void applyAfterMoveFix() {
        onScrollChanged(getScrollX(), getScrollY(), getScrollX(), getScrollY());
    }
}