BetterSpinner icon indicating copy to clipboard operation
BetterSpinner copied to clipboard

setText and the other options disappears

Open Jackcar opened this issue 9 years ago • 11 comments

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?

Jackcar avatar Jan 19 '16 14:01 Jackcar

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?

douglasjunior avatar Jan 20 '16 02:01 douglasjunior

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);

Jackcar avatar Jan 20 '16 10:01 Jackcar

At some other time you're calling setAdapter?

douglasjunior avatar Jan 20 '16 12:01 douglasjunior

No, just in the beginning.

Jackcar avatar Jan 20 '16 13:01 Jackcar

You could create a small sample project to replicate the problem?

So I can have a check for you.

douglasjunior avatar Jan 20 '16 13:01 douglasjunior

This is strange, because I used the better spinner in another activity with setText, but it give me no problems.

Jackcar avatar Jan 20 '16 13:01 Jackcar

Yes. Unfortunately I dont know.

douglasjunior avatar Jan 20 '16 13:01 douglasjunior

Same problem occurs to me I made the Spinner lost focus, then other options came out.

my541619352 avatar May 19 '16 02:05 my541619352

Without replicating the problem is difficult to help.

douglasjunior avatar May 19 '16 11:05 douglasjunior

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

Debarshi-Banerjee avatar Jan 03 '17 09:01 Debarshi-Banerjee

@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?

smarques84 avatar Mar 16 '17 15:03 smarques84