Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Attachment actions
Unintended behavior
View staffing
Description
Jetpack Compose component used: TextField
Android Studio Build: Koala 2024.1.1
Kotlin version: 1.9.0
Steps to Reproduce or Code Sample to Reproduce:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
AndroidUITestingTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Box(modifier = Modifier.fillMaxSize()) {
Greeting(
name = "Android",
modifier = Modifier
.padding(innerPadding)
.align(Alignment.Center)
)
}
}
}
}
}
}
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
val focusManager = LocalFocusManager.current
val focusRequester = remember { FocusRequester() }
Surface(
modifier = Modifier.fillMaxSize().focusRequester(focusRequester)
) {
Column(
modifier = modifier.clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() },
onClick = {
focusManager.clearFocus()
}
)
) {
TextField(value = name, onValueChange = {})
}
}
}