I need to build a ScrollableTabRow
that include text
and image
.
:
(this screen shot was taken on compose 1.0.0-alpha09)
but after I upgrade compose to 1.0.0, the image didn't show. the image tab item is empty:
the ScrollableTabRow
demo code:
@Composable
fun ScrollableRowWithImage(){
ScrollableTabRow(
backgroundColor = Color.Transparent,
selectedTabIndex = 0,
edgePadding = 24.dp,
modifier = Modifier.wrapContentSize(align = Alignment.CenterStart)
) {
(1..4).forEach{ _ ->
Tab(
selected = false,
onClick = { },
) {
Image(
painter = rememberImagePainter(
data = "http://mstphoto.cmvideo.cn:8080/clt/20210607/09/1F7I2L5NT7HQ.png",
),
contentDescription = null,
)
}
}
}
}
The image can display normally in ohter place:
@Composable
fun ScrollableRowWithImage(){
Column(modifier = Modifier.fillMaxSize()) {
ScrollableTabRow(
backgroundColor = Color.Transparent,
selectedTabIndex = 0,
edgePadding = 24.dp,
modifier = Modifier.height(80.dp)){
(1..4).forEach{ _ ->
Tab(
selected = false,
onClick = { },
) {
SampleImage()
}
}
}
Divider()
SampleImage()
}
}
@Composable
fun SampleImage(){
Image(
painter = rememberImagePainter(
data = "http://mstphoto.cmvideo.cn:8080/clt/20210607/09/1F7I2L5NT7HQ.png",
),
contentDescription = null,
)
}