Webview Textarea Doesn't Pop Up the Keyboard

WebView textarea doesn't pop up the keyboard

The problem was that webview wasn't getting focus when it was loaded hence using

webView.requestFocus(View.FOCUS_DOWN);

solved the problem.

Android keyboard not showing when clicking on input in webview

Please try to add these lines to your webview in the XML file.

android:focusable="true"
android:focusableInTouchMode="true"

Hope it helps.

webview inside an alertBuilder, keyboard doesnt pop up

You can define fake keyboard like this:

 AlertDialog.Builder alert = new AlertDialog.Builder(this); 
WebView wv = new WebView(this);
LinearLayout wrapper = new LinearLayout(this);
EditText keyboardHack = new EditText(this);
keyboardHack.setVisibility(View.GONE);
wv.getSettings().setJavaScriptEnabled(true);
wv.loadUrl(loadUrl);
wv.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);

return true;
}
});

wrapper.setOrientation(LinearLayout.VERTICAL);
wrapper.addView(wv, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
wrapper.addView(keyboardHack, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
alert.setView(wrapper);

Webview html input form not showing/allowing keyboard

As Brent suggested, following line will serve the purpose -

webView.requestFocus(View.FOCUS_DOWN);

this happens because on page loading webpage loses its focus so this line just bring the focus back to page.

For those who end up at this question, A detailed discussion on this topic is here

iOS webview autofocus doesn't work on keyboard open

The issue seems to be related to the iOS version. iOS version 10 or below works perfectly fine while 11.1 has this issue. Newest iOS 11.2.5 seems to not have the issue though

When keyboard open webview not scrolling

You have to resize your layout when keyboard open, so it would be scrollable in other area

set programmatically

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

and change height of WebView

android:layout_height="100.0dp"

to

android:layout_height="match_parent"

Flutter webview text input gets hidden by soft keyboard

The answer for me was two things.

First to use this line which sets WebView.platform inside the stateful widget showing the webview. Notice that it's specific to my testing at the time on Android, so perhaps for some of you when you didn't see the issue, you maybe were on iOS?

  @override
void initState() {
super.initState();
if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); // <<== THIS
}

Second I added a Scaffold with resizeToAvoidBottomInset set to true and removed my use of this:

height: MediaQuery.of(context).size.height * (MediaQuery.of(context).viewInsets.bottom != 0 ? .7 : 1),`

Here is the code for the body with the webview

@override
Widget build(BuildContext context) {
return SafeArea(
child: Stack(
children: [
initialUrl == null
? Container()
: Scaffold(
resizeToAvoidBottomInset: true,
body: WebView(
initialUrl: initialUrl,
javascriptMode: JavascriptMode.unrestricted,
onPageStarted: (controller) {},
onPageFinished: (controller) {
Future.delayed(Duration(milliseconds: 1234), () {
if (mounted) {
showLoading = false;
setState(() {});
}
});
},
navigationDelegate: (NavigationRequest request) {
if (request.url.startsWith('https://example.com/success')) {
Navigator.of(context).pop('success');
} else if (request.url.startsWith('https://example.com/cancel')) {
Navigator.of(context).pop('cancel');
}
return NavigationDecision.navigate;
},
),
),
showLoading == true
? Center(
child: Container(width: 80, height: 80, child: CircularProgressIndicator()),
)
: Container(),
],
),
);
}


Related Topics



Leave a reply



Submit