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

后端 未结 2 611
既然无缘
既然无缘 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: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.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题