Android soft Keyboard not open in webView`

后端 未结 5 609
轻奢々
轻奢々 2021-02-08 04:56

I m Using WebView in AlertDialog to authenticate user to twitter. but When i click on field in webview ,android keyboard doesnt open. here is my code that shows how i added webv

5条回答
  •  失恋的感觉
    2021-02-08 05:40

    I had a similar issue and solved it in this way:

    1. I override the onCreateView() method on the dialog fragment and define all view stuff configuration for my web view.

      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      
          View view = inflater.inflate(R.layout.webview, container, false);
          // do some config
          // some other stuffs
      
          loginpage.loadUrl(url);
          return view;
      }
      
    2. On the onCreateDialog() method i just add these.

      @Override
      public Dialog onCreateDialog(Bundle savedInstaceState) {
          Dialog dialog = super.onCreateDialog(savedInstaceState);
          dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
          return dialog;
      }
      

    In my case i wanted to show a dialog with no title. So due the DialogBuilder take care of creating dialog's view i decided to override the onCreateView() and just call the super.onCreateDialog() and add my window configuration.

提交回复
热议问题