Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webview not resizing when keyboard appears

Need to resize my webview similar to Cordova/Phonegap when keyboard appears. Right now as per below code, My input text fields are getting overlayed by device keyboard. I want to squeeze height of webview and make it adjust height above device keyboard.

Activity code :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg_home">

<include android:id="@+id/head" layout="@layout/header" />

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="11dp"
    android:layout_marginLeft="11dp"
    android:layout_marginRight="11dp"
    android:layout_marginTop="2dp"
    android:layout_below="@id/head"
    android:background="@drawable/overlay_bg2"
    android:orientation="vertical"
    android:padding="9dp" >

    <WebView
        android:id="@+id/webView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:layout_gravity="center"
        android:isScrollContainer="true"/>

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleLargeInverse"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:visibility="invisible" />

</FrameLayout>

</RelativeLayout>

Manifest Entries :
Theme android:theme="@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"


Activity keyboard control android:windowSoftInputMode="adjustResize"

like image 938
Abhinav Tyagi Avatar asked Feb 13 '15 09:02

Abhinav Tyagi


1 Answers

As far as I know, If your activity (or application as a whole) is set to full screen; android:windowSoftInputMode="adjustResize" won't work.

like image 93
TheOnlyAnil Avatar answered Oct 19 '22 13:10

TheOnlyAnil