BetterSpinner
BetterSpinner copied to clipboard
setText and the other options disappears
I need to set an item selected, but how doesn't exist setSelection I tried to use setText, but when I did this, the other options in spinner disappears, somebody knows what's going on?
It is okay to use setText because the selected value is only informative.
It's strange you say that the other options are disappearing. How are you using your Adapter?
I'm using like this:
String[] statusArray = getActivity().getResources().getStringArray(R.array.statusArray);
statusAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_dropdown_item_1line, statusArray);
statusAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mStatusSpinner.setAdapter(statusAdapter);
At some other time you're calling setAdapter
?
No, just in the beginning.
You could create a small sample project to replicate the problem?
So I can have a check for you.
This is strange, because I used the better spinner in another activity with setText, but it give me no problems.
Yes. Unfortunately I dont know.
Same problem occurs to me I made the Spinner lost focus, then other options came out.
Without replicating the problem is difficult to help.
I faced this problem..So i removed android:focusableInTouchMode="false" from xml and IT DID WORK.....maybe its related to some focus event bug....didnt had time to dig deeper
@douglasjunior This issue seems to happen when we are using the spinner inside a fragment, in my case i am using the spinner inside a DialogFragment populated with a list. If you create a simple android button to change the text of the spinner you will reproduce the issue. Remember the spinner has to be inside a fragment for the issue to appear
@my541619352 what do you mean by "made the spinner lost focus"? I tried request focus on other component but the problem doesn't go away
@Jackcar Did you eventually fixed the problem?