0

When I use the soft keyboard to type in a text inside a WebView, it hides the field and I cannot see what I am typing.

I found out in the official documentation and also this link, this question, also this question and many other websites that by using :

android:windowSoftInputMode="adjustResize"

in the Android Manifest would do the trick.

It normally works BUT in my case I have my WebView in Full Screen where this prevents the above adjustResize code to work.

I also tried in onCreate() the following code:

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);

where it does it full screen but still the adjustResize is not working.

So my question is how I can use android:windowSoftInputMode="adjustResize" or any other way and also have my WebView in fullscreen as well?

EDIT:

android:windowSoftInputMode="adjustResize" 

or

android:windowSoftInputMode="adjustPan"

This code works but not in Full Screen.

Community
  • 1
  • 1
Johny
  • 625
  • 2
  • 6
  • 26

2 Answers2

0

try this

WebView webView=new WebView(getActivity());
        webView.post(new Runnable() {
            @Override
            public void run() {
                getWindow().clearFlags(
                        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
                                WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM|WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            }
        });
Farido mastr
  • 464
  • 5
  • 12
0

I have been trying to get this work on an app I am working upon. I haven'y yet gotten an answer as well.

As for you, you can try setting android:fitsSystemWindows="true" in the rootView of your layout.

Abhishek
  • 61
  • 7