开发者

android disable move to next field

开发者 https://www.devze.com 2023-03-08 15:02 出处:网络
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 e

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开发者_JS百科, 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?


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"


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

android:imeOptions="actionDone"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号