2011-12-01 64 views

回答

0

嘗試this..it可以幫助全..

TextView textview=(TextView)findViewById(R.id.searchText);//searchText is the id in XML layout 
textview.setImeOptions(EditorInfo.IME_ACTION_SEARCH);// here it using for search operation..it depends upon your process 
textview.setOnEditorActionListener(new TextView.OnEditorActionListener() { 
    @Override 
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { 
     if (actionId == EditorInfo.IME_ACTION_SEARCH) 
       { 
      //peform operation.. if search key is pressed in keypad, it comes inside the condition.. 
      return true; 
     } 
     return false; 
    } 
});