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(); }
##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(); }