关于Android WebView的硬件加速的几个问题:
android TV 应用使用webview加载网页,但是出现网页数据跳动、网络监控播放卡顿问题;所以考虑使用硬件加速;
为什么我开启硬件加速不成功?
AndroidManifest.xml
<application
android:name=".base.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:hardwareAccelerated="true"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
...
webview:
// 开启硬件加速
wvMaintContent.setLayerType(View.LAYER_TYPE_HARDWARE,null);
这个判断一直返回false
if (wvMaintContent.isHardwareAccelerated()) {
Log.i(TAG,"已开启硬件加速");
} else {
Log.i(TAG,"未开启硬件加速");
}