android軟鍵盤enter鍵的替換與事件監聽

    軟件盤的界面替換隻有一個屬性android:imeOptions,這個屬性的能夠取的值有normal,actionUnspecified,actionNone,actionGo,actionSearch,actionSend,actionNext,actionDone,例如當值爲actionNext時enter鍵外觀變成一個向下箭頭,而值爲actionDone時enter鍵外觀則變成了「完成」兩個字。  java

咱們也能夠重寫enter的事件,方法以下  android

TextView editText = new TextView(this);
editText.setOnEditorActionListene(
newTextView.OnEditorActionListener() {   
          public boolean onEditorAction(TextView v, int actionId,   
                            KeyEvent event){   
                        if (actionId == EditorInfo.IME_ACTION_SEND)   
                        {   
                            // 在這裏編寫本身想要實現的功能   
                        }   
                        return false;   
          }   
});
相關文章
相關標籤/搜索