1

In my Android application, I have several EditText controls and spinners (almost 400 controls like that)... when I select a spinner, after selection the focus goes to EditText randomly, sometime top most edit text... due to this I have to scroll down and when I choose another spinner value, again focus goes to EditText.

Is there any way to avoid this so that the focus stays in the control which is chosen?

teobais
  • 2,820
  • 1
  • 24
  • 36
Subramanian Raj
  • 389
  • 2
  • 5
  • 16

3 Answers3

0

On your spinner view, try

android:nextFocusUp="@id/spinner"
android:nextFocusLeft="@id/spinner"`
Blackwood
  • 4,504
  • 16
  • 32
  • 41
P. Ilyin
  • 761
  • 10
  • 28
  • This looks more than comment, instead of answer. – Damian Kozlak Dec 28 '15 at 13:47
  • *Try* for me, means that you are not sure that it can help resolve someone's problem. It's like *try this, maybe this will help, maybe not*. Your post has been marked as low quality by system. That is my opinion during review, there are other people also who will check your posts and make final decision. – Damian Kozlak Dec 28 '15 at 13:56
  • Since some dude called my answer as comment, all my answers are comments? – P. Ilyin Dec 28 '15 at 13:59
  • No. Like I said, that is just **my** opinion in review queue. Yours - this - answer was marked by system as possible low quality, not me. I'm just making review and giving my opinion. Please read this - http://stackoverflow.com/help/how-to-answer – Damian Kozlak Dec 28 '15 at 14:03
0

Try android:nextFocusDown="your_second_spinner_id ".You can also try other attribute like nextFocusForward etc.

akhil Rao
  • 1,169
  • 7
  • 17
0

I haven't tried it myself, but I suppose either the first link or a combination of the following ones, will solve your problem:

https://stackoverflow.com/a/23235769/2486904
Spinner does not get focus
Adding Focus to a spinner

Community
  • 1
  • 1
teobais
  • 2,820
  • 1
  • 24
  • 36