按照惯例,先获取控件,再加监听。。。
1 searchView = (SearchView) view3.findViewById(R.id.search); 2 searchView.setOnQueryTextListener(new OnQueryTextListener() { 3 4 @Override 5 public boolean onQueryTextSubmit(String query) { 6 Log.d("MainActivity", "onQueryTextSubmit(), query=" + query); 7 8 return false; 9 } 10 11 @Override 12 public boolean onQueryTextChange(String newText) { 13 Log.d("MainActivity", "onQueryTextChange(), newText=" + newText); 14 return false; 15 } 16 17 });
时间: 2024-10-13 17:09:36