本文介紹了知道編輯文本何時完成編輯的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我如何知道我的編輯文本何時完成編輯?就像用戶選擇下一個框,或者按下軟鍵盤上的完成按鈕時一樣.
How do I know when my edit text is done being edited? Like when the user selects the next box, or presses the done button on the soft keyboard.
我想知道這一點,以便我可以鉗位輸入.看起來文本觀察者的 afterTextChanged 發(fā)生在輸入每個字符之后.我需要對輸入進行一些計算,所以我想避免在輸入每個字符后進行計算.
I want to know this so I can clamp the input. It looks like text watcher's afterTextChanged happens after each character is entered. I need to do some calculations with the input, so I would like to avoid doing the calculation after each character is entered.
謝謝
推薦答案
通過使用類似這樣的東西
By using something like this
meditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
switch (actionId){
case EditorInfo.IME_ACTION_DONE:
case EditorInfo.IME_ACTION_NEXT:
case EditorInfo.IME_ACTION_PREVIOUS:
yourcalc();
return true;
}
return false;
}
});
這篇關于知道編輯文本何時完成編輯的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!