Kubilay
Kubilay

Reputation: 53

The soft keyboard on Android covers up text boxes so users can't see what's being typed

I couldnt do it, it isnt focus to webview's input or textarea

I have click to last input.;

https://i.sstatic.net/MGG3L.png

It should be same this (android web browser)

https://i.sstatic.net/WFRta.png

what should i do?

MainActivity.js;

webview = (WebView) findViewById(R.id.webView1);
        webview.getSettings().setJavaScriptEnabled(true);
        webview.loadUrl("http://mutlugunluk.com");


        webview.requestFocus(View.FOCUS_DOWN);
        webview.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                    case MotionEvent.ACTION_UP:
                        if (!v.hasFocus()) {
                            v.requestFocus();
                        }
                        break;
                }
                return false;
            }
        });

activity_main

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
        <WebView
            android:id="@+id/webView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
</RelativeLayout>

Manifest

<activity
        android:windowSoftInputMode="adjustPan|adjustResize"
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Upvotes: 1

Views: 78

Answers (1)

Bojan Kopanja
Bojan Kopanja

Reputation: 734

Did you try setting Window SoftInput Mode property to adjustPan and adjustResize for the activity?

In Manifest.xml set for that Activity:

<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity>

That should do the "trick" with moving up everything when the keyboard pops up.

Note: This should work if the top element is RelativeLayout, so try changing LinearLayout to RelativeLayout

Upvotes: 2

Related Questions