Cicero
04/27/2021, 9:21 AMAlbert Chang
04/27/2021, 9:36 AMCicero
04/27/2021, 10:25 AMColton Idle
04/27/2021, 11:19 AMZach Klippenstein (he/him) [MOD]
04/27/2021, 1:01 PMCicero
04/27/2021, 2:51 PMCicero
04/27/2021, 3:09 PMButton(modifier = Modifier
.fillMaxWidth()
.height(80.dp)
.padding(start = 16.dp, end = 16.dp),
colors = ButtonDefaults.buttonColors(backgroundColor = Color(0xFF224599)),
onClick = { /*TODO*/ }) {
Image(
painter = painterResource(id = R.drawable.ic_articles),
contentDescription = null,
contentScale = ContentScale.Fit
)
Spacer(modifier = Modifier.width(16.dp))
Text(
"ba",
fontSize = 14.sp,
color = Color(0xFFFFFFFF),
letterSpacing = 1.25.sp
)
}
Cicero
04/27/2021, 3:59 PMCicero
04/27/2021, 4:17 PMButton(modifier = Modifier
.fillMaxWidth()
.height(80.dp)
.padding(start = 16.dp, end = 16.dp),
colors = ButtonDefaults.buttonColors(backgroundColor = Color(0xFF224599)),
onClick = { /*TODO*/ }) {
Image(
painter = painterResource(id = R.drawable.ic_articles),
contentDescription = null,
contentScale = ContentScale.Fit
)
Spacer(modifier = Modifier.width(16.dp).height(80.dp))
Text(
"ba",
modifier = Modifier.padding(bottom = 16.dp),
fontSize = 14.sp,
color = Color(0xFFFFFFFF),
letterSpacing = 1.25.sp
)
}
I don’t have the code for the first one but the text had bottom padding 😐Chris Sinco [G]
04/28/2021, 11:44 PMIcon has a fixed size I believe
Icon
by default if no modifier is specified will be sized at 24.dp x 24.dp with ContentScale.Fit
. Material icons use this as the default size.Chris Sinco [G]
04/28/2021, 11:49 PMImage
on the other hand will size things based on the asset if no modifiers are specified. It also doesn’t do any tinting with contentColor
and just uses the asset as-is.Chris Sinco [G]
04/28/2021, 11:52 PMRowScope
that is being used for Button
. You can see here that content
is placed with horizontal arrangement centered and vertical alignment centered also. If you want to change the exact alignment of the child components in Button
you can do it with Spacer
or padding but the results are competing against other default values in the implementation.Chris Sinco [G]
04/28/2021, 11:52 PMButton
from scratch if you really want to, so you can have more granular control over things.Cicero
04/29/2021, 8:28 AMCicero
04/29/2021, 11:03 AMChris Sinco [G]
04/29/2021, 4:03 PMI couldn’t reproduce my issue but the thing is that the text had some padding and the icon was anchored to the bottom, didn’t mattered what I didGotcha - if you ever can repro, please post the code here!
Cicero
04/29/2021, 4:17 PM