I want to make an IconButton
with text below the icon. I have tried applying those width-related methods in Modifier
to all the IconButton
, Column
, Icon
and Text
. The code below the is closest I got. The result looks like this. And this is what I want to achieve.
@Composable
fun IconButtonWithTextBelow(
title: String,
@DrawableRes imageId: Int,
onClick: () -> Unit
) {
IconButton(
onClick = onClick,
modifier = Modifier.requiredWidth(IntrinsicSize.Max)
) {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.requiredWidth(IntrinsicSize.Max)
) {
Icon(
painter = painterResource(id = imageId),
contentDescription = title,
)
Text(
text = title,
)
}
}
}