Vince Rickey
11/16/2020, 3:50 PMAndroidView(viewBlock = { webView })
. This will load most webpages, but it fails to load resource intensive iFrames such as an interactive elections map graphic.
I added the hardware acceleration tag to the app's Manifest, but still no luck. A log shows that the Fragment's rootview is hardware accelerated, but the Composable's AndroidView is not. The docs state that hardware acceleration is only possible through the Manifest's application or activity tags, or programmatically through the Window. I'm wondering if AndroidView doesn't support this yet if it isn't attached to the Activity or Window under the hood.
Has anyone else encountered difficulty with hardware acceleration with AndroidView interop? Code snippet in the thread.<application android:hardwareAccelerated="true" ...>
@Composable
fun WebComponent() {
val webView = remember {
WebView(context).apply {
settings.javaScriptEnabled = true
webViewClient = WebViewClientCompat()
...
}
}
AndroidView(viewBlock = { webView }) { view ->
Log.d("WebComponent", "WebComponent is hardware accelerated: ${view.isHardwareAccelerated}")
...
}
}
romainguy
11/16/2020, 6:48 PMisHardwareAccelerated
will only return true
once the View
is attached to the window. You are logging it too early to know what’s going onVince Rickey
11/16/2020, 7:20 PM