我想通過按下鍵盤上的'完成'按鈕來關閉編輯首選項對話框(如圖http://twitpic.com/18ttdp所示)。關閉鍵盤上的android首選項對話框ACTION_DONE按
目前,按'完成'只是解散鍵盤,但離開對話框。
在我的應用程序的其他部分我用類似下面的攔截「完成」按鍵,並在我的活動執行動作代碼:
text.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
//do stuff here
return true;
}
return false;
}
});
不過,我不確定如何做實現這一目標在我的偏好活動或佈局xml中也有同樣的效果。
當您攔截「完成」按鈕時,您是否可以通過在對話框中點擊「確定」按鈕時發生的相同事件? – Feet 2010-03-16 00:22:55
我該怎麼做? – Damian 2010-03-16 09:31:20
這個鏈接可能會有所幫助http://stackoverflow.com/questions/11236264/change-action-of-done-button-on-virtual-keyboard-android/27035143#27035143 – Nepster 2014-11-20 08:46:11