标签:void contex 元素 this 需要 添加 etc 调试 uil
手机端由原生切换为H5,定位不到元素。需要将apk开启调试模式:在入口Activity中添加2行代码,如下
if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
效果如下:
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
super.onCreate(savedInstanceState);
context = this;
if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
......
......
标签:void contex 元素 this 需要 添加 etc 调试 uil
原文地址:https://www.cnblogs.com/jdm532000/p/9668335.html