Need Prev,Next button above soft keyboard in android

↘锁芯ラ 提交于 2020-01-14 19:35:07

问题


I want to show the virtual keyboard with Prev, Next Buttons above the keyboard. When the user clicks prev button, cursor should move to the previous edittext input field and clicking on next button should go to the next edittext field in the view.

IF we open any page in android browser which asks input, we can see this kind of keyboard.

I need that to be implemented for the normal activity which I created. May I know how to do this ?

Thanks, Senthil.M


回答1:


For Next Button just add one line to your edit text field

   EditText et1 = (EditText)findViewById(R.id.editText1);
    et1.setImeOptions(EditorInfo.IME_ACTION_NEXT);
   EditText et2 = (EditText)findViewById(R.id.editText2);
    et2.setImeOptions(EditorInfo.IME_ACTION_NEXT);

and i m also search about previous Button Please check

Add Button to Android Soft Keyboard




回答2:


Simply set imeOptions to actionNext or actionPrev in EditText tag in xml like

<EditText
android:imeOptions="actionNext"
/>

And you can also set it programmatically like

yourEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT);


来源:https://stackoverflow.com/questions/7306088/need-prev-next-button-above-soft-keyboard-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!