Kotlin Disable WebView Click (KDWC)

Hi guys, this time I want to share a solution for the case study "How to disable click events in WebView". Initially we wanted to print the WebView display to a thermal printer, but before that we need to scan it first into a bitmap (image).

The process of scanning the WebView display into a bitmap (image) takes quite a long time, so we need to limit interaction with the user. Using android:clickable="false" cannot be the expected solution. Finally, we can do it in the following way.

mWebView.setOnTouchListener( new View.OnTouchListener() {
    @Override
    public boolean onTouch (View v, MotionEvent event) {
         return  true ;
    }
});

Post a Comment

Previous Next

نموذج الاتصال