WAI
Status Update
Comments
ar...@gmail.com <ar...@gmail.com> #2
Thanks for the report. I was puzzled.
pa...@gmail.com <pa...@gmail.com> #3
The same for me. Android 4.0.4.
al...@android.com <al...@android.com> #4
This is intentional to reduce complexity of Spinner's API and implementation. Consider using a full-blown ListView in a dialog instead.
mi...@mictale.com <mi...@mictale.com> #6
I just spent 3 hours on this issue and I disagree that it is "working as intended". If you want to make developers happy, fail fast.
Spinner$DropDownAdapter wraps the client's adapter and shadows getItemViewType() and getViewTypeCount() and simply returns constants. This will never work as intended if the inner adapter has more view types.
I suggest the DropDownAdapter constructor asserts if adapter.getViewTypeCount() != 1.
Spinner$DropDownAdapter wraps the client's adapter and shadows getItemViewType() and getViewTypeCount() and simply returns constants. This will never work as intended if the inner adapter has more view types.
I suggest the DropDownAdapter constructor asserts if adapter.getViewTypeCount() != 1.
j2...@gmail.com <j2...@gmail.com> #7
THIS NEEDS TO BE FIXED.
ar...@gmail.com <ar...@gmail.com> #8
What's going on with this issue?
[Deleted User] <[Deleted User]> #9
Implementation of Spinner.setAdapter() has changed in API 21 to enforce this, and now throws an exception.
From setAdapter's documentation:
On API LOLLIPOP and above, attempting to set an adapter with more than one view type will throw an IllegalArgumentException.
From setAdapter's documentation:
On API LOLLIPOP and above, attempting to set an adapter with more than one view type will throw an IllegalArgumentException.
Description
The source code shows that Spinner#DropDownAdapter delegate most calls to the injected adapter, except for #getViewTypeCount and #getItemViewType which just return 1 and 0 respectively.
I am using Honeycomb. The workaround is to unify all the different view types into a single layout view, and hide all except one of the views.