I try to follow developer.android.com/jetpack/compose/text#displaying-text and get
Unresolved reference: remember
Unresolved reference: mutableStateOf
Unresolved reference: OutlinedTextField
Unresolved reference: it
What am I doing wrong?
The whole function:
@Composable
fun SimpleOutlinedTextFieldSample() {
var text by remember { mutableStateOf("") }
OutlinedTextField(
value = text,
onValueChange = { text = it },
label = { Text("Label") }
)
}
Imports:
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.example.kotlinprojectapp.ui.theme.KotlinProjectAppTheme
CodePudding user response:
correct imports:
import androidx.compose.runtime.remember
import androidx.compose.material.OutlinedTextField
import androidx.compose.runtime.mutableStateOf