I have my dimen.xml
with all demintions that I use over the app. Now with jetpack compose I would like to use these demintions also here
There is a text:
...
Text(
text = stringResource(id = R.string.brandname),
fontSize = 12.sp
)
...
I can get text from the resources, however, I can't get 12.sp
value from dimen.xml
, I am trying to do it like this
...
Text(
text = stringResource(id = R.string.brandname),
fontSize = dimensionResource(id = R.dimen.brandname_size)
)
...
I got an error in the fontSize
line - type mismatch, required TextUnit
, found Dp
What am I missing here?
Should just be fontSize = dimensionResource(id = R.dimen.brandname_size).value.sp