Peter
05/06/2025, 11:40 AMTextField
not focusable, but still keep it clickable?Peter
05/06/2025, 11:41 AMval launcher = rememberLauncherForActivityResult(OpenDocumentTree()) { uri ->
uri?.let { onPathChanged(it) }
}
OutlinedTextField(
readOnly = true,
value = path?.toString().orEmpty(),
onValueChange = {},
modifier = modifier
.clickable { launcher.launch(null) }
// .focusProperties { canFocus = false }
)
Alex Styl
05/06/2025, 12:36 PMArne Jans
05/06/2025, 12:36 PMPeter
05/06/2025, 12:38 PMExposedDropdownMenuBox
, with difference being that I want to show system directory picker instead of having dropdown popup.Alex Styl
05/06/2025, 12:39 PMPeter
05/06/2025, 12:40 PMArne Jans
05/06/2025, 12:43 PMTextField(
// The `menuAnchor` modifier must be passed to the text field to handle
// expanding/collapsing the menu on click. A read-only text field has
// the anchor type `PrimaryNotEditable`.
modifier = Modifier.menuAnchor(ExposedDropdownMenuAnchorType.PrimaryNotEditable),
state = textFieldState,
readOnly = true,
lineLimits = TextFieldLineLimits.SingleLine,
label = { Text("Label") },
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },
colors = ExposedDropdownMenuDefaults.textFieldColors(),
)
Arne Jans
05/06/2025, 12:45 PMmattinger
05/06/2025, 1:52 PMText
control to you apply some styling to (like a border or whatever) and make it clickable. This makes much more logical sense (at least to me) than trying to shoehorn a TextField
into a purpose it's not meant for.
This is what i do when i have what you would call a "Spinner" in the xml view world. I have a styled Text
that is clickable and on clicking, it shows a drop down menu.