Cash Hsiao
10/28/2020, 3:57 AMConstraintLayout
will have a probability to be rendered or not.
I also discovered this issue in Owl project.Cash Hsiao
10/28/2020, 4:00 AMSurface(modifier = Modifier.fillMaxSize()) {
ConstraintLayout(modifier = Modifier.fillMaxSize()) {
val (logo, brand) = createRefs()
Image(
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.FillWidth,
asset = imageResource(id = R.drawable.black_background)
)
Icon(
modifier = Modifier.wrapContentSize().constrainAs(logo) {
top.linkTo(<http://parent.top|parent.top>)
bottom.linkTo(parent.bottom)
start.linkTo(parent.start)
end.linkTo(parent.end)
},
asset = vectorResource(id = R.drawable.ic_logo),
tint = white
)
Icon(
modifier = Modifier.wrapContentSize().constrainAs(brand) {
top.linkTo(logo.bottom, 2.dp)
start.linkTo(parent.start)
end.linkTo(parent.end)
},
asset = vectorResource(id = R.drawable.ic_brand),
tint = white
)
}
}
I've tried several times with this view, it will have 4 combinations: both logo and brand show, only logo shows, only brand shows and none of them show.Chethan
10/28/2020, 6:08 AMSurface(modifier = Modifier.fillMaxSize()) {
Box {
Image(
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.FillWidth,
asset = vectorResource(id = R.drawable.ic_bk)
)
ConstraintLayout(modifier = Modifier.fillMaxSize()) {
val (logo, brand) = createRefs()
Icon(
modifier = Modifier.wrapContentSize().constrainAs(logo) {
top.linkTo(<http://parent.top|parent.top>)
bottom.linkTo(parent.bottom)
start.linkTo(parent.start)
end.linkTo(parent.end)
},
asset = vectorResource(id = R.drawable.ic_logo),
tint = Color.White
)
Icon(
modifier = Modifier.wrapContentSize().constrainAs(brand) {
top.linkTo(logo.bottom, 2.dp)
start.linkTo(parent.start)
end.linkTo(parent.end)
},
asset = vectorResource(id = R.drawable.ic_lux),
tint = Color.White
)
}
}
}
Cash Hsiao
10/28/2020, 6:58 AM