android 解决混合开发h5使用vue开发在android 5.0的情况下webview加载出现白屏,vue报错,崩溃适配
public class LollipopFixedWebView extends WebView {
public LollipopFixedWebView(Context context) {
super(getFixedContext(context));
}
public LollipopFixedWebView(Context context, AttributeSet attrs) {
super(getFixedContext(context), attrs);
}
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(getFixedContext(context), attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(getFixedContext(context), attrs, defStyleAttr, defStyleRes);
}
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) {
super(getFixedContext(context), attrs, defStyleAttr, privateBrowsing);
}
public static Context getFixedContext(Context context) {
return context.createConfigurationContext(new Configuration());
}
}
该文章提供了一个名为`LollipopFixedWebView`的自定义WebView解决方案,旨在修复在Android5.0系统上,使用Vue进行H5开发时在WebView中加载出现白屏和报错的问题。通过创建一个针对Lollipop版本的配置上下文,该类能帮助适配并防止应用崩溃。
3468

被折叠的 条评论
为什么被折叠?



