答案 0 :(得分:1)
只需将onclicklistener添加到搜索按钮即可。
private OnClickListener searchListener = new OnClickListener() {
public void onClick(View v) { // do something when the button is clicked
}
};
protected void onCreate(Bundle savedValues) {
// Capture search button from layout
Button button = (Button)findViewById(R.id.search_btn);
// Register the onClick listener with the implementation above
button.setOnClickListener(searchListener);
}
看看this
答案 1 :(得分:1)
searchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Put your search functionality here
}
});