3

Before I made a native android app which contains a number input. when you click in it numeric keyboard of android pops up which has done button which hides keypad after clicking done button. but now i have made another similar app but it contains WebView so it is a website created using html,JavaScript, css etc. which has <input type ="number"/> and again numeric keypad of android pops up but no done button in it. it looks like the webview is handled by browser keypad. is it possible to add done button here?

1
  • can't you use keyUp and keyDown override method to achieve ur task? Jan 19, 2018 at 6:40

2 Answers 2

1

Please check out the following trick in Menifest.xml file for the activity which is having your webview

AndroidManifest.xml

<activity android:name="..."
  ...
   android:imeOptions="actionSend|flagNoEnterAction"
  ...
</activity>

Hope it works.

3
1

Sharing code how i am detecting EditText in Webview

 mWebView = (MyWebView) findViewById(R.id.webview);
    mWebView.setOnTouchListener(new View.OnTouchListener() { 
        @Override
        public boolean onTouch(View v, MotionEvent event) {

        WebView.HitTestResult hr = ((WebView)v).getHitTestResult();
        int type = hr.getType();

          if (type == WebView.HitTestResult.EDIT_TEXT_TYPE) {
            //Calls When user touch edittext in webview
            //Open Keyboard with done button programatically

            return;
          }
      return false; 
     }
});

This is working fine for my task...Hope this help you also

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.