rey5137 / material

A library to bring fully animated Material Design components to pre-Lolipop Android.
http://rey5137.com/material/
Apache License 2.0
6.01k stars 1.32k forks source link

Spinner unable to drop down items in spinner #327

Open RbkGh opened 8 years ago

RbkGh commented 8 years ago

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 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 commented 8 years ago

@rey5137 ,have you examined this yet?

RickBoyerDev commented 7 years ago

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.

RbkGh commented 7 years ago

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

RickBoyerDev commented 7 years ago

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?

RbkGh commented 7 years ago

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.

RickBoyerDev commented 7 years ago

Thanks @RbkGh, I appreciate the help!

RbkGh commented 7 years ago

My pleasure