I'm designing a layout where we have some layout at top and an adview at bottom of the screen. For this I'm using below code.
ConstraintLayout(
modifier = Modifier
.fillMaxSize()
.background(colorResource(id = R.color.purple_200))
) {
val (scannerView, adView) = createRefs()
Text(text = "Hello composable", modifier = Modifier
.constrainAs(scannerView) {
start.linkTo(parent.start)
end.linkTo(parent.end)
bottom.linkTo(parent.top)
})
AndroidView(modifier = Modifier
.constrainAs(adView) {
start.linkTo(parent.start)
end.linkTo(parent.end)
bottom.linkTo(parent.bottom)
},factory = { context ->
AdView(context).apply {
setAdSize(AdSize.BANNER)
adUnitId = context.getString(R.string.banner_id)
loadAd(AdRequest.Builder().build())
}
})
}
But issue i'm facing is the AdView is not getting laid out at bottom instead it is ignoring constraints and showing on top of the screen. The same thing is working for other composable like Text or Image etc but not for only AndroidView. Any help is appreciated. Thanks in advance.