question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exposed Dropdown Menu failing to display items

See original GitHub issue

Since 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:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

22reactions
adrian05commented, May 24, 2019

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.

5reactions
2martenscommented, Jul 25, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exposed Dropdown Menu not showing items - Stack Overflow
Exposed Dropdown Menu doesn't show items after user selection and fragment transition. ... As mentioned here, it was set on AutoCompleteTextView's ...
Read more >
Exposed Drop-Down Menu in Android | by Emine İNAN
With the help of the Exposed Drop-Down Menu, we can quickly and easily select an item from a list. ... Permalink Failed to...
Read more >
Exposed Material Drop-Down Menu in Android
The Exposed Drop-Down menu is the replacement for Spinner in Android because Spinner is not that customizable like the new exposed Drop-Down ...
Read more >
ExposedDropdownMenuDefaults - Android Developers
Contains default values used by Exposed Dropdown Menu. ... Default trailing icon for Exposed Dropdown Menu. TextFieldColors. @Composable
Read more >
How to Create Drop-Down and Fly-Out Menus That Are Web ...
Users who are reliant on a keyboard must be able to navigate your drop-down menus via the tab key and the enter key....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found