androidandroid-jetpack-composeandroid-jetpack-compose-material3

Can't add modifier to a Text composable


I can't add a modifier to a Text in my android app in Jetpack Compose.

I want something like this:

Text(
   text = AnnotatedString(resultString),
   Modifer = Modifier.horizontalScroll(scroll),
)

But it gives me an error: None of the following functions can be called with the arguments supplied.

I tried it without the modifier and then it worked.

(I'm using material3)


Solution

  • The attribute is modifier.

    Use

    Text(
       text = AnnotatedString(resultString),
       modifier = Modifier.horizontalScroll(scroll),
    )