binding.btQuery.setFocusableInTouchMode(true);
binding.btQuery.requestFocus();
延迟获取焦点。 /** * 请求焦点 */ public static void requestFocus(final View view) { view.postDelayed(new Runnable() { @Override public void run() { view.requestFocus(); } }, REQUESTFOCUSDELAY); }
binding.btQuery.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
query();
return false;
}
});