EditText 一些常用操作 如監聽任榮變化,改變鍵盤上的字 等等

改變鍵盤上的回車變爲搜索按鈕

有的事一個放大鏡有的會顯示成搜索兩個字
etSearch.setImeOptions(EditorInfo.IME_ACTION_SEARCH);//設置搜索屬性
//監聽按下的操作
etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId==EditorInfo.IME_ACTION_SEARCH){
if (TextUtils.isEmpty(v.getText().toString())){
UITipDialog.showFall(ExhibitionCenterActivity.this,”請輸入要搜索內容”);
return true;
}
mRefreshHelper.onDefaluteMRefresh(true);
}
return true;
}
});

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章