Exposed Dropdown Menu failing to display items
See original GitHub issueSince c71b6ccb has been pushed to 1.1.0-alpha06, we finally have a nice dropdown menu, replacing Spinners with AutoCompleteTextView. It’s a nice change, however I found a small issue with it while using databinding.
The following databinding extensions were used, with the layout:
https://gist.github.com/fonix232/6553f66d17746dca5d062eecf40e8b3b
It’s a bit hackier than a regular Spinner, and if I do the same logic manually from the actual view, it works quite well. However in binding, it just fails miserably.
The above binding will display only one item in the drop down menu, the one selected (in fact I’m posting this after not having the null check in the selectedValue
binding, which resulted in an empty, glitching list, and the value being permanently (null)
). Unless I cycle through all the items manually upon binding the Adapter, the list stays empty, which is nuts.
What the hell is going wrong here? This binding should work even without the null checks, yet it doesn’t. And the databinding execution context shouldn’t be that different than calling the same stuff from the fragment’s (technically, a Conductor controller’s) onAttached method.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
Not sure if I understood your issue properly but I had a similar issue with AutoCompleteTextView after programatically setting it’s text.
My AutoCompleteTextView adapter was pointing to an array with 3 values and I wanted to select a value by default when loading the view so I used the setText(string text) method.
The issue in my case was that once I did: autoCompleteTextView.setText(“value1”) then from the UI when I was opening the dropdown to select another value there was only one option in the list (“value1”).
After some googling I found out that AutoCompleteTextView has a setText method that accepts a boolean parameter: settext(string text, boolean filter) and by setting the filter to false I had access to all the values one again. Maybe it helps you too.
I have found a post that explains what the problems are - rant included. https://medium.com/@rmirabelle/there-is-no-material-design-spinner-for-android-3261b7c77da8