Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android disable move to next field

In my android application I have several editTexts in a linear layout. Then I have several spinners below them in the same linear layout. If a spinner item is selected it jumps back up to one of the edit text fields. I would compare it to pressing tab when your filling out a webform, it automatically jumps to the next field. That would be fine except it jumps back closer to the top of the layout and the user has to scroll back down to click the submit button. Is there any way to disable the automatic move so the application won't force a move to the next field?

like image 450
Jonathan Avatar asked Nov 20 '25 08:11

Jonathan


2 Answers

I don't know if there is an easy way to disable it entirely. But you can control which views get focus next by setting the

android:nextFocusRight
android:nextFocusLeft
android:nextFocusUp
android:nextFocusDown

attributes in your layout xml. You would set them ="@+id/idOfTheNextView"

like image 95
FoamyGuy Avatar answered Nov 21 '25 23:11

FoamyGuy


Although late by years here but you can use this setting on the EditText

android:imeOptions="actionDone"
like image 22
sudhanshu Avatar answered Nov 21 '25 22:11

sudhanshu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!