2014-01-28 79 views

回答

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. 
+0

请进一步解释 – everton

+0

@EveronAgner yes.done – Manmohan

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


     }); 
相关问题