material icon indicating copy to clipboard operation
material copied to clipboard

Spinner unable to drop down items in spinner

Open RbkGh opened this issue 9 years ago • 7 comments

I have extended BaseAdapter and set adapter to the spinner. The data shows as set on the Spinner successfully but when clicked on,the dropdown of the list of data does not work.It just plays the ripple animation on the spinner but nothing happens. I simulated the same thing with the default android spinner(android.widget.Spinner) and it works but when the same custom adapter is set to com.rey.material.widget.spinner,nothing happens,although the data is visibly shown on the spinner.I even tried the example application style by annotating my oncreateView to target HoneyComb. @rey5137 ,Kindly help me find what I am doing wrong.Thanks in advance.

AccountGroupsSpinnerItem acc = new AccountGroupsSpinnerItem("hello","2"); AccountGroupsSpinnerItem acc2 = new AccountGroupsSpinnerItem("Family","46"); List<AccountGroupsSpinnerItem> accountGroupsSpinnerItemList = new ArrayList<>(); accountGroupsSpinnerItemList.add(acc); accountGroupsSpinnerItemList.add(acc2); AllGroupsSpinnerAdapter allGroupsSpinnerAdapter = new AllGroupsSpinnerAdapter(getActivity(),accountGroupsSpinnerItemList); groupsSpinner.setAdapter(allGroupsSpinnerAdapter);

    android.widget.Spinner spin = (android.widget.Spinner) rootView.findViewById(R.id.groups2);
    spin.setAdapter(allGroupsSpinnerAdapter);//notice I set the default android Spinner too for testing and that works.

spinner_groups_all_row.txt

AccountGroupsSpinnerItem.txt AllGroupsSpinnerAdapter.txt

RbkGh avatar Jan 15 '16 22:01 RbkGh

@rey5137 ,have you examined this yet?

RbkGh avatar Feb 22 '16 15:02 RbkGh

Hi @RbkGh, I experienced this same problem when trying to create a custom spinner adapter. Considering the lack of response to your post, I went a different route. Instead of using a custom adapter, I just used the alternative ArrayAdapter constructor that allows passing in both the layout and text field ID. This achieved the same goal for me.

RickBoyerDev avatar Nov 28 '16 15:11 RickBoyerDev

That's good to know,but I reverted to a different library which handled that perfectly for me.Thanks anyway.

RbkGh avatar Nov 29 '16 13:11 RbkGh

Hi @RbkGh, fortunately, the constructor I mentioned applies to the standard Spinner as well. I've just been testing this library myself and I'm not planning on using it going forward either since this one seems to no longer be supported. I'm curious, which library did you go with?

RickBoyerDev avatar Nov 29 '16 16:11 RickBoyerDev

It's been a while,just dug through that codebase and this is what i used in the build.gradle file com.github.navasmdc:MaterialDesign:1.5@aar .If my memory serves me right,it requires nineoldandroids as a dependency.You can check it out.

RbkGh avatar Nov 30 '16 00:11 RbkGh

Thanks @RbkGh, I appreciate the help!

RickBoyerDev avatar Nov 30 '16 09:11 RickBoyerDev

My pleasure

RbkGh avatar Nov 30 '16 13:11 RbkGh