2015-07-04 92 views
0

我想在我的活動中使用WebView來顯示標準登錄頁面,但是看起來鍵盤總是覆蓋頁面的下半部分(並且它不允許您'滾動'未覆蓋的部分,就像你期望的那樣)。Android軟鍵盤覆蓋WebView內容

往上看這個問題,我已經試過平時

android:windowSoftInputMode="adjustResize" 

但是這似乎並沒有工作。 (我也試過調整潘)

Now I found this issue,但我看過棒棒糖的應用程序滾動webview像你期望發生。

任何想法?我很難過。

編輯另外,我的活動沒有使用全屏標誌。

這裏是我的活動的XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_height="56dp" 
     android:layout_width="match_parent" 
     android:paddingTop="25dp" 
     android:fitsSystemWindows="true" 
     app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     android:background="?attr/colorPrimary" /> 


    <WebView 
     android:id="@+id/webview_login" 
     android:fitsSystemWindows="true" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

</LinearLayout> 
+0

檢查 「fitsSystemWindows」 屬性 –

+1

@IITAmiya嗯,那沒似乎有任何影響。我在Activity中唯一的視圖就是工具欄,即使在刪除之後,也會出現同樣的問題。 – russjr08

回答

1

也許你可以覆寫名爲onSizeChanged()方法如下:

@Override 
protected void onSizeChanged(int w, int h, int oldw, int oldh) { 
    super.onSizeChanged(w, h, oldw, oldh); 
    if (onSizeChangedListener != null) { 
     onSizeChangedListener.onSizeChanged(w, h, oldw, oldh); 
    } 
}