A bit of hacks, but it's possible. You must create a javascript
bridge between the WebView
and your java
code.
class JsBridge { @JavascriptInterface public void showNativeSpinner() {
In the html
code you need to remove / hide the select
and add somekind from the placeholder that you can click. Disabling select
will not work, because the disconnected item cannot receive events (cannot be pressed). Then add the onclick
callback, which invokes the bridge method. All this can be done using javascript.
$("#my-select").hide(); $("#my-select-parent").append("<div id='placeholder'></div>"); $("#placeholder").on("click", function() { jsBridge.showNativeSpinner(); });
You can execute javascript`` code to the
,, javascript`` code to the
WebView from the
java,,, code
webView.loadUrl("javascript:yourLogicFunction()");
The last thing you need to do is add OnItemSelectedListener
to the spinner and to the listener method to call javascript
callbacks in the WebView
using the loadUrl
method.
This should solve your problem :)
source share