Android:更改键盘上的“完成”按钮文本

时间:2014-01-28 12:46:31

标签: android

我是Android开发的新手。是否可以在键盘上更改“完成”按钮的文字?如果是的话,怎么做?

4 个答案:

答案 0 :(得分:2)

您可以在xml中为textview设置ImeOptions。他们很多 这个 Link for imeOptions

例如各种imeOptions ..

actionNone       IME_ACTION_NONE.
actionGo         IME_ACTION_GO.
actionSearch     IME_ACTION_SEARCH.
actionSend       IME_ACTION_SEND.
actionNext       IME_ACTION_NEXT.

答案 1 :(得分:1)

  EditText input = new EditText(context);
  input.setImeOptions(EditorInfo.IME_ACTION_DONE);
  input.setImeActionLabel("My Text", EditorInfo.IME_ACTION_DONE);

或者你可以在XML

中完成
  android:imeActionLabel="My Text"

答案 2 :(得分:0)

android:imeOptions="actionDone"

答案 3 :(得分:0)

像这样使用:

   <EditText       
        android:layout_width="match_parent"
        android:layout_height="wrap_content"            
        android:imeOptions="actionGo"           
     />

并调用此函数以使用操作:

mInstrunctionEditTxt
        .setOnEditorActionListener(new OnEditorActionListener() {

            @Override
            public boolean onEditorAction(TextView v, int actionId,
                    KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_GO) {
                    // do what action you want
                }

                return false;
            }               


        });