EditText添加android:imeOptions="actionSearch"彈出的鍵盤中帶有搜索按鈕


首先在布局文件中的EditText添加android:imeOptions="actionSearch"   android:inputType="text";

phoneEd.setOnEditorActionListener(new TextView.OnEditorActionListener(){ 

    @Override  

public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {  

// TODO Auto-generated method stub  

if(arg1 == EditorInfo.IME_ACTION_SEARCH)  

                {  

                    Toast.makeText(AddMemberActivity.this,"呵呵",Toast.LENGTH_SHORT).show();  

// search pressed and perform your functionality.  

               }  

return false;  

           }  

        });  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM