开发者

android virtual keyboard listener

开发者 https://www.devze.com 2023-02-05 22:15 出处:网络
Though i have asked the question before but dint开发者_开发问答 get any proper answer. I have an EditText when edit text is focused android virtual keyboard pops up, i have added Done button to the ke

Though i have asked the question before but dint开发者_开发问答 get any proper answer. I have an EditText when edit text is focused android virtual keyboard pops up, i have added Done button to the keyboard using ime option from property window. Now i want to perform some action by pressing the Done button. How to do this? Please any body help.


you an do it by firest finding reference of edittext and than set belows code for ur edittext:


 editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_SEARCH) {
            performSearch();//do here your stuff f
            return true;
        }
        return false;
    }
  });

here i have taken editText name which is ref. editextbox which u added and you have to add actionId==type of ime options which u have setted

0

精彩评论

暂无评论...
验证码 换一张
取 消