Richard Z
06/08/2021, 1:38 PMAdam Powell
06/08/2021, 1:41 PMRichard Z
06/08/2021, 1:42 PMRichard Z
06/08/2021, 1:43 PMAdam Powell
06/08/2021, 1:43 PMModifier.fillMax[Width|Height|Size]()
on the AndroidView
composable should be equivalent to the advice suggested around MATCH_PARENT
Richard Z
06/08/2021, 1:43 PMAdam Powell
06/08/2021, 1:43 PMAdam Powell
06/08/2021, 1:45 PMRichard Z
06/08/2021, 1:46 PMRichard Z
06/08/2021, 1:59 PM@Composable
fun Test() {
val context = LocalContext.current
AndroidView({
WebView(context).apply {
// layoutParams = ViewGroup.LayoutParams(
// ViewGroup.LayoutParams.MATCH_PARENT,
// ViewGroup.LayoutParams.MATCH_PARENT
// )
settings.domStorageEnabled = true
settings.javaScriptEnabled = true
webViewClient = WebViewClient()
webChromeClient = WebChromeClient()
loadUrl("<https://www.google.com/>")
}
})
}
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
// A surface container using the 'background' color from the theme
Surface(color = MaterialTheme.colors.background) {
Test()
}
}
}
}
}
Adam Powell
06/08/2021, 2:20 PMRichard Z
06/08/2021, 2:26 PMRichard Z
06/08/2021, 3:38 PMAdam Powell
06/08/2021, 5:19 PMharry248
03/24/2022, 4:21 PM