Home > Java > javaTutorial > body text

Reasons and solutions why Android WebView cannot pop up the soft keyboard

高洛峰
Release: 2017-01-07 11:44:19
Original
2536 people have browsed it

requestFoucs(); is invalid.

requestFoucsFromTouch(); is invalid.

webview.setTouchListener; Invalid.

The problem:

When inheriting WebView, pay attention to the construction method:

public CommonWebView(Context context) {
super(context);
init();
}
public CommonWebView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public CommonWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
Copy after login

##defStyleAttr cannot pass 0, the following is the wrong way to write it :

public CommonWebView(Context context) {
this(context,null,0);
}
public CommonWebView(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public CommonWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
Copy after login

The above is the reason why Android WebView cannot pop up the soft keyboard and the solution introduced by the editor. I hope it will be helpful to everyone. If If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank you all for your support of the PHP Chinese website!

For more related articles on the reasons and solutions for why Android WebView cannot pop up the soft keyboard, please pay attention to the PHP Chinese website!



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template