html textfield in WebView in an Android application is hidden by the soft keyboard

后端 未结 2 609
既然无缘
既然无缘 2021-01-02 16:07

I have an Android application that is a TabHost with a WebView. I use it to load a specific html file that has a text field in its bottom part.

When I touch the html

相关标签:
2条回答
  • 2021-01-02 16:38

    I was getting crazy nothing works android:windowSoftInputMode="adjustResize" may help but be sure to have your app not in full screen.

    Removing full screen for my app solved the problem with the layout resize with softkeyboard.

    <item name="android:windowFullscreen">false</item>
    
    0 讨论(0)
  • 2021-01-02 16:44

    I found a solution for this issue. (about a week after I posted the question; I only got to answering in stackoverflow today...)

    I had pieces in my code that changed the WebView's height (to have room for a TabBar). Turns out that when you invoke setLayoutParams on a WebView, it will no longer change its height even if you have android:windowSoftInputMode="adjustResize" set.

    I circumvented the need to change the WebView's height by adding the TabBar to the main.xml layout file, with an initial size of 0. When I increase the TabBar's size, the WebView's size decreases automatically, and it preserves the android:windowSoftInputMode="adjustResize" behavior.

    0 讨论(0)
提交回复
热议问题