I want to know two things please:
I would like to resize an image in Jetpack Compose but I get an error:
Unresolved reference: size
What am I supposed to import because I imported this
import androidx.compose.ui.Modifier
Where can I see what can be imported because this is surely the biggest headache knowing what to import.
Also how do I use the colors I specify in my colors.xml file located in the res directory.
I want to use the colors I have in my resource file called colors.xml
Here is my composable trying to set an image size and a button I want to give a background color to:
@Composable
fun Logo(modifier: Modifier = Modifier) {
Image(
painter = painterResource(id = R.drawable.slipsol),
contentDescription = "The SlipSol logo",
modifier = Modifier.size(80.dp),
contentScale = ContentScale.Crop
)
}
@Composable
fun FrontButtons() {
Column {
Logo()
Button(
onClick = {},
modifier = Modifier.width(200.dp),
shape = RoundedCornerShape(4.dp),
colors = ButtonDefaults.buttonColors(containerColor = Color.Green)
) {
Text("See Promotions")
}
}
}
Help is appreciated thanks