Android WebView JellyBean -> Should not happen: no rect-based-test nodes found

前端 未结 8 1595
南旧
南旧 2020-11-30 20:32

My application is using a lot of webviews which are lying in fragments which are hold by a ViewPager.

Whenever i swipe through the app on my Galaxy Nexus with Jelly

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 21:27

    I had this exact issue. The problem is exactly what Rahul Dole said in his answer above.

    I spend a few days on this trying tons of different things. I noticed that when the orientation changed that the visible WebView onLongClick worked again...so I came up with this little gem. Indeed its very hacky but it works!

    Use this in your class that extends WebView:

    @Override
    public boolean onTouchEvent(MotionEvent event) {
    
        if (event.getAction() == MotionEvent.ACTION_DOWN){
    
            int temp_ScrollY = getScrollY();
            scrollTo(getScrollX(), getScrollY() + 1);
            scrollTo(getScrollX(), temp_ScrollY);
    
        }
    
        return super.onTouchEvent(event);
    }
    

提交回复
热议问题