Closed techker closed 8 months ago
Not an issue, Just a question.
I have a login page that i would like to set the focus on the username box automaticly on page load?
i have tried to add val focusRequester = remember { FocusRequester() } val focusRequesterModifier = Modifier.focusRequester(focusRequester)
but can't add modifier to textField Or focusRequester not found?
...... modifier = Modifier .fillMaxWidth() .focusRequester(focusRequester) .....
TvTextField( value = username.value, label = "Username") { username.value = it } TvTextField() -> OutlinedTextField( textStyle = MaterialTheme.typography.bodyLarge, colors = TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colorScheme.surface, cursorColor = MaterialTheme.colorScheme.surface, focusedLabelColor = MaterialTheme.colorScheme.surface, ), interactionSource = mutableInteractionSource, label = { Text(text = label) }, value = value, visualTransformation = visualTransformation, keyboardOptions = KeyboardOptions(keyboardType = keyboardType), onValueChange = onValueChange, )
Hey. Please ask questions on Stackoverflow and add the android-jetpack-compose-tv tag.
android-jetpack-compose-tv
Not an issue, Just a question.
I have a login page that i would like to set the focus on the username box automaticly on page load?
i have tried to add val focusRequester = remember { FocusRequester() } val focusRequesterModifier = Modifier.focusRequester(focusRequester)
but can't add modifier to textField Or focusRequester not found?
...... modifier = Modifier .fillMaxWidth() .focusRequester(focusRequester) .....
TvTextField( value = username.value, label = "Username") { username.value = it } TvTextField() -> OutlinedTextField( textStyle = MaterialTheme.typography.bodyLarge, colors = TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colorScheme.surface, cursorColor = MaterialTheme.colorScheme.surface, focusedLabelColor = MaterialTheme.colorScheme.surface, ), interactionSource = mutableInteractionSource, label = { Text(text = label) }, value = value, visualTransformation = visualTransformation, keyboardOptions = KeyboardOptions(keyboardType = keyboardType), onValueChange = onValueChange, )