I have float value 360F. I created a filed called float.xml
inside res/values
.
float.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="loading_circle_target" format="float" type="dimen">360</item>
</resources>
and use like this
@Composable
fun LoadingCircle() {
val currentRotation by transition.animateValue(
0F,
targetValue = dimensionResource(id = R.dimen.loading_circle_target).value,
// .. more code in here
)
// more code in here
}
I am getting error in here
android.content.res.Resources$NotFoundException: Resource ID #0x7f070346 type #0x4 is not valid at android.content.res.Resources.getDimension(Resources.java:766)
at androidx.compose.ui.res.PrimitiveResources_androidKt.dimensionResource(PrimitiveResources.android.kt:79)
UPDATE
I have minimum sdk is 21