https://kotlinlang.org logo
#compose
Title
# compose
a

abbic

12/02/2021, 9:58 AM
Hi folks, in the 1.1.0-beta03 version of compose material library we have added a new ExposedDropdownMenuBox component that is fantastic, but the default design is the filled dropdown menu style, not the outlined one which is what i'm looking for. is there a way to configure it such?
the two styles in question
d

Didier Villevalois

12/02/2021, 10:32 AM
Have you tried to put an
OutlinedTextField
inside your
ExposedDropdownMenuBox
instead of the
TextField
demonstrated in the API docs?
a

abbic

12/02/2021, 10:35 AM
a good idea! it basically works except it keeps the darker background colour
d

Didier Villevalois

12/02/2021, 11:05 AM
Could you share a code snippet?
a

abbic

12/02/2021, 11:06 AM
yes, i have some findings but my computer's at a standstill thanks to a build 😆
the jist is that you can change the style to outlined successfully simply by replacing the TextField with an OutlinedTextFeild, except when you pass the colours in you should override the background colour to be transparent (or something else), as such
Copy code
OutlinedTextField(
                            readOnly = true,
                            value = selectedOptionText,
                            onValueChange = { },
                            label = { Text("Label") },
                            trailingIcon = {
                                ExposedDropdownMenuDefaults.TrailingIcon(
                                    expanded = expanded
                                )
                            },
                            colors = ExposedDropdownMenuDefaults.textFieldColors(
                                backgroundColor = Color.Transparent
                            )
                        )