I am trying to make layout using Jetpack Compose.
I want to show an Image and a Text in each Card, stacked vertically using Column widget
I could successfully wrote the code using Composable function but I am getting issues in last Card like below mentioned:
- The Image width is not FULL
- The TextView is not showing below Image
Code :
@Composable
fun Dashboard(name1: String, name2: String, name3: String) {
Column(
modifier =
Modifier.background(color = Color(0, 255, 0, 255))
) {
Card() {
Column(modifier = Modifier.padding(10.dp)) {
Image(painter = painterResource(id = R.drawable.img1),
contentDescription = "Image 1")
Text(text = name1)
}
}
Card() {
Column(modifier = Modifier.padding(10.dp)) {
Image(painter = painterResource(id = R.drawable.img2),
contentDescription = "Image 2")
Text(text = name2)
}
}
Card() {
Column(modifier = Modifier.padding(10.dp)) {
Image(painter = painterResource(id = R.drawable.img2),
contentDescription = "Image 3")
Text(text = name3)
}
}
}
}
The Last Card's image (img2) is same as middle Card's image but is giving issue at last index only
Can anyone help what is wrong in my Composable Function?
Reference:
I am following tutorials of The Hyper Coder community this one
1.0.0-beta01
– Kushalbeta03
– Kushal