Tejas Sutar
Tejas Sutar

Reputation: 777

Android: Change "Done" button text on keyboard

I am new to Android development. Is it possible to change "Done" button's text on keyboard? If yes, how to do that?

Upvotes: 1

Views: 3284

Answers (4)

Dakshesh Khatri
Dakshesh Khatri

Reputation: 629

android:imeOptions="actionDone"

Upvotes: 1

Manmohan Badaya
Manmohan Badaya

Reputation: 2336

you can set ImeOptions for textview in xml. their are many as per this Link for imeOptions

for example various imeOptions..

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

Upvotes: 2

Ravind Maurya
Ravind Maurya

Reputation: 977

use like this:

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

and call this function to use action:

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;
            }               


        });

Upvotes: 0

Nick Cardoso
Nick Cardoso

Reputation: 21733

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

Alternatively you can do it in the XML

  android:imeActionLabel="My Text"

Upvotes: 3

Related Questions