Monodroid: WebView input/textarea never get virtual keyboard focus
Today I found a very strange issue.
This looks like here.
But we can reproduce this on 1-2 of our devices like Nexus, Xoom… (May depends on Android 4.1.x version)
So – WebView creating, opening html, but no one input/textarea get virtual keyboard focus.
I tried every solution for that link, and just only #35 helps me (big thanks to author):
For those who encountered this issue on Jelly Beans: When you use one of the WebView constructors with more then 2 arguments applying the defStyle parameter, the default style com.android.internal.R.attr.webViewStyle will not be applied! For me the fix was to set the defStyle parameter to android.R.attr.webViewStyle. e.g. to init a WebView with private browsing use new WebView(this, null, android.R.attr.webViewStyle, true) where this is a Context. Hope to have saved somebody days of investigation (as in my case)..
But my project is on Monodroid. I couldn’t find android.R.attr.webViewStyle value in Monodroid and just find it in SDK
My constructor now looks like:
const int WEVVIEWSTYLE = 16842885;
public MyWebView (Context context) : base(context, null, WEVVIEWSTYLE)
Awesome, but why?!
Leave a comment