I am using a `WebView` inside an `AndroidView` and...
# compose
m
I am using a
WebView
inside an
AndroidView
and it's so heavy, while it works smoothly in traditional way see the code in thread
Copy code
AndroidView(
    factory = { context ->

        LinearLayout(context).apply {
            layoutParams = LayoutParams(MATCH_PARENT, MATCH_PARENT)

            val webView = WebView(context).apply {
                layoutParams = LayoutParams(MATCH_PARENT, MATCH_PARENT)

                webChromeClient = WebChromeClient()

                settings.javaScriptEnabled = true
                addJavascriptInterface(JavaScriptInterface(context), "interface")
                loadUrl("file:///android_asset/editor.html")
            }

            addView(
                webView
            )
        }
    }
)
a
Why are you wrapping it inside LinearLayout?
m
I added some buttons around
a
Seems like this should be enough -
Copy code
AndroidView(factory = ::WebView, modifier = Modifier.fillMaxSize())
Which version of Compose are you using? In beta02 there were some fixes for no hardware accelerated devices.
m
I'm using beta01, I'll try out your suggestions thanks in advance
It works just like a charm thanks budd you saved my life
🙏🏻 1
🙏 1