How to track the down arrow button in virtual keyboard?

邮差的信 提交于 2020-01-11 05:27:21

问题


In the above figure i want to listen for down arrow( i have marked it in red colour, the key one which is used to hide the keyboard). I have tried to get it action through menu options, viewconfiguration class etc. But it is not useful. Is there any method, listeners or any callback event to track this button. Please let me know your suggestions and thoughts. Any help in this regard is highly appreciable

Thanks inAdvance


回答1:


In your activity, override this method: http://developer.android.com/reference/android/app/Activity.html#onBackPressed()




回答2:


If I am not you talking about this method

public boolean onKeyDown(int keyCode, KeyEvent event) {
super.onKeyDown(keyCode, event);
    switch(keyCode)
    {

    case KeyEvent.KEYCODE_BACK:
     Toast.makeText(KeyActions.this, "Pressed Back Button", Toast.LENGTH_SHORT).show();

        return true;
    }

    return false;
}


来源:https://stackoverflow.com/questions/16159802/how-to-track-the-down-arrow-button-in-virtual-keyboard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!