marios proto
08/26/2021, 2:49 PM@Composable
fun IconTopLeftText(
backgroundImageId: Int,
iconId: Int,
padding: Int = 16,
imagePadding: Int,
text: String,
textColor: Int,
textSize: Int
) {
Box(modifier = Modifier
.padding(padding.dp)
.semantics(true) { }) {
val drawable = AppCompatResources.getDrawable(LocalContext.current, backgroundImageId)
Image(
rememberDrawablePainter( drawable ),
contentDescription = null)
Row(
horizontalArrangement = Arrangement.Start,
verticalAlignment = <http://Alignment.Top|Alignment.Top>,
) {
Image(
painter = painterResource(id = iconId),
modifier = Modifier
.padding(end = imagePadding.dp),
contentDescription = null
)
Text(
text = text,
fontSize = textSize.sp,
color = colorResource(id = textColor)
)
}
}
}
Any ideas what am I missing please?Dmitrii Smirnov
08/26/2021, 3:02 PMmarios proto
08/26/2021, 3:12 PMdivid3d
08/26/2021, 3:13 PMModifier.alignBy(FirstBaseLine)
on Image would allow you to achieve such behaviour.marios proto
08/26/2021, 3:15 PMImage(
painter = painterResource(id = iconId),
modifier = Modifier
.padding(end = imagePadding.dp)
.offset(y=5.dp),
contentDescription = null
)
I am going to give some offset to the image to make it more alignedColton Idle
08/26/2021, 3:33 PMmarios proto
08/26/2021, 3:34 PMColton Idle
08/26/2021, 4:12 PMChris Sinco [G]
08/26/2021, 6:10 PMlineHeight
of the Text
to the same height as the Icon
? That might get the alignment for the first line in the paragraph.