您好我有EDITTEXT与imeoption actionsearch,当我点击虚拟键盘搜索图标我需要调用一个函数,我有覆盖的onkeydown但我不会得到控制研究,当我preSS搜索,我做什么
解决方案 ed1.setOnEditorActionListener(新OnEditorActionListener(){ @覆盖 公共布尔onEditorAction(TextView的V,INT actionId,KeyEvent的事件){ 如果(actionId == EditorInfo.IME_ACTION_SEARCH){ 的System.out.println(搜索pssed $ P $ .........); } 返回false; } });
hi i have edittext with imeoption actionsearch ,when i click search icon in virtual keyboard i need to invoke a function, i have override onKeydown but i won't get controll when i press search , what i do
解决方案ed1.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId==EditorInfo.IME_ACTION_SEARCH){
System.out.println("Search pressed.........");
}
return false;
}
});