When I create new project and select "Empty Compose Activity (Material3)", I can't use OutlinedTextField.
When I create new project and select "Empty Compose Activity"
it's Ok
Why there is a different and how can I fix this?
In your build.gradle
upgrade the Material3 dependency to the latest as below.
implementation 'androidx.compose.material3:material3:1.0.1'
This shows OutlinedTextField
in the project.
You must also add the @OptIn(ExperimentalMaterial3Api::class)
to your function as below.
@OptIn(ExperimentalMaterial3Api::class)
OutlinedTextField(
value = text,
onValueChange = { text = it },
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With