KotlinLeaner
04/05/2023, 3:59 PMletterSpacing in my Text() . I did it like this
letterSpacing = 0.7.sp
but when I move this value to dimen.xml and using like this
letterSpacing = dimensionResource(id = R.dimen.text_letter_spacing),
It giving me error on Text() . Error in threadKotlinLeaner
04/05/2023, 3:59 PMNone of the following functions can be called with the arguments supplied.
Text(AnnotatedString, Modifier = ..., Color = ..., TextUnit = ..., FontStyle? = ..., FontWeight? = ..., FontFamily? = ..., TextUnit = ..., TextDecoration? = ..., TextAlign? = ..., TextUnit = ..., TextOverflow = ..., Boolean = ..., Int = ..., Map<String, InlineTextContent> = ..., (TextLayoutResult) → Unit = ..., TextStyle = ...) defined in androidx.compose.material
Text(String, Modifier = ..., Color = ..., TextUnit = ..., FontStyle? = ..., FontWeight? = ..., FontFamily? = ..., TextUnit = ..., TextDecoration? = ..., TextAlign? = ..., TextUnit = ..., TextOverflow = ..., Boolean = ..., Int = ..., (TextLayoutResult) → Unit = ..., TextStyle = ...) defined in androidx.compose.materialromainguy
04/05/2023, 4:09 PMdimensionResource returns a value in dp but letterSpacing expects TextUnitKotlinLeaner
04/05/2023, 4:10 PMChrimaeon
04/05/2023, 4:11 PMLocalDensity for convertion:
letterSpacing = with(LocalDensity.current){dimensionResource(id=R.dimen.text_letter_spacing).toSp()}KotlinLeaner
04/05/2023, 4:12 PMChrimaeon
04/05/2023, 4:13 PMdimensionResource will return a dp and with this method you are then converting this dp into spromainguy
04/05/2023, 4:15 PMromainguy
04/05/2023, 4:15 PMromainguy
04/05/2023, 4:16 PMKotlinLeaner
04/05/2023, 4:16 PMColton Idle
04/05/2023, 4:37 PMStylianos Gakis
04/05/2023, 8:11 PMSiyamed
04/05/2023, 8:44 PMColton Idle
04/05/2023, 11:21 PMdorche
04/06/2023, 12:44 PM