When Spinner is Focusable, it requires a double click to open

JSourpJSourp USMember ✭✭
edited April 2015 in Xamarin.Android

When I set the following:

spinner.Focusable = true;
spinner.FocusableInTouchMode = true;

Why do I need to click each 'Spinner' twice before the options display? Seems as if the first click is bringing focus to the 'Spinner', and the second is opening it. How can I set it so that a single click (and/or next soft keyboard click) opens the 'Spinner'?

Also, I have 'android:imeOptions' set to 'actionNext' for my EditText. How can I get something like this for a 'Spinner', so once a 'Spinner' item is selected, focus moves on to the next element?

Thanks!

Question was spawned from this question.

Best Answer

Answers

  • BenMessengerBenMessenger AUUniversity ✭✭

    Jonathan,
    Did you ever get a resolution to this issue? I have the same problem and it is definitely the setting focusable. I require it to actually fire a focuschange event on a edittext view. If I do not have focusable set, then the textview never loses focus and the event does not get fired. But if I want the users to just single click to get the spinner to show the options, I cannot have it focusable.
    It seems like pretty weird behaviour to me, and I'd love to know a solution.

  • JSourpJSourp USMember ✭✭

    I have not yet resolved this issue. I got pulled in a different direction shortly after posting this question. Once I get back to development of this app, I hope there is a resolution.

    Keep me posted if you discover a solution, thanks!

  • JSourpJSourp USMember ✭✭

    This looks like a great work around, thank you very much!

  • DivyaYadavDivyaYadav Member

    Write this line of code wherever you are implementing setOnItemClickListener for your spinner :

    spinner.requestFocusFromTouch();
    

    This will tell the spinner to invoke with one click and display the list of items.

Sign In or Register to comment.