Код: Выделить всё
@Composable
fun ReusableAndroidViewInLazyColumnSample() {
val urls =
listOf(
"https://developer.android.com/jetpack/compose",
"https://google.github.io/accompanist/",
"https://android-developers.googleblog.com/",
"https://io.google/",
// ...
)
LazyVerticalGrid(columns = GridCells.Adaptive(512.dp)) {
items(urls) { url ->
AndroidView(
factory = { context ->
WebView(context).apply {
settings.javaScriptEnabled = true
webViewClient =
object : WebViewClient() {
// Optional overrides for WebViewClient
}
}
},
modifier = Modifier.fillMaxWidth().aspectRatio(1f),
update = { webView -> webView.loadUrl(url) },
onReset = { webView ->
webView.stopLoading()
webView.loadUrl("about:blank")
webView.clearHistory()
}
)
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... ck-compose