I don’ t understand why i can’t have a card with i...
# compose
a
I don’ t understand why i can’t have a card with image that filled all card.
Copy code
Column(modifier = Modifier.fillMaxSize().padding(10.dp)) {
    WPToolBar("Grid", textColor = Color.Blue, showBack = true)
    Spacer16()
    Row(
        modifier = Modifier.fillMaxWidth().weight(1f)) {
        Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
            CardCell()
        }

        Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
            CardCell()
        }
    }
    
    Row(
        modifier = Modifier.fillMaxWidth().weight(1f)) {
        Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
            CardCell()
        }

        Box(modifier = Modifier.weight(1f).fillMaxHeight()) {
            CardCell()
        }
        
    }
}

@Composable
fun CardCell() {
    Card(elevation = 4.dp,  shape = RoundedCornerShape(20.dp) ,modifier = Modifier.fillMaxSize().padding(10.dp)) {
            Image(
                contentScale = ContentScale.Fit,
                contentDescription = null,
                painter = painterResource(id = R.drawable.preview2)

            )
        }
}
n
Can you pass
FillWidth
or
Crop
for the
contentScale
?
a
great , thanks
n
did it work?
a
yes
👍🏻 1
👍 1
perfect.. online … i didn’t see contentScale in all example
n
yes there are not that much samples on the Internet as Compose is not mature yet I guess 🙂
c
Always know you can navigate to the definition of the Composable in Android Studio with Cmd/Ctrl+B. It's a very useful way to see all the parameters a component supports, e.g. contentScale
1