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