Android disable webview input

2019-08-15 19:43发布

问题:

I have a layout that features a webview and various UI elements on top of the webview. This is a relativelayout.

Currently, no matter how many elements are visible on top of the webview, all scrolling will scroll the webview, it can still accept clicks and more. I want to conditionally disable these features of the webview

I am using myWebview.setClickable(false) but this seems to have no effect

insight appreciated

回答1:

I'm not confident about this, but perhaps forcing the WebView to drop its focus will do. Try myWebview.clearFocus(). Let me know if that worked or not. I'm not at my computer right now, otherwise I would know. :)