Reputation: 2268
I have a WebView
that loads a remote web page (this one), whose HTML is not in my control. On that page, there is an email field that is required and maybe it has email validation.
When I tap on that email field to type email address, Android's keyboard shows up but when I start typing, it doesn't write anything in it. There are some other fields as well and they also are required and possibly have validation but they take input fine. Only the email field is causing this problem.
That email field is working just fine in Android Firefox and Google Chrome.
Javascript is enabled on my WebView
but it does nothing. Does anyone know how can I make that email field take input?
Upvotes: 1
Views: 59
Reputation: 1017
Your keyboard is not supporting that field in WebView
. So you need to force WebView
to open default keyboard.
You have to customize WebView
by extending WebView
class. Override its onCreateInputConnection()
method:
import android.content.Context
import android.util.AttributeSet
import android.view.inputmethod.BaseInputConnection
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputConnection
import android.webkit.WebView
class QWebView : WebView
{
constructor(context: Context?) : super(context)
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, privateBrowsing: Boolean) : super(context, attrs, defStyleAttr, privateBrowsing)
override fun onCreateInputConnection(outAttrs: EditorInfo?): InputConnection
{
return BaseInputConnection(this, false)
}
}
Upvotes: 1