开发者

Android virtual keyboard - catch Shift+enter events

开发者 https://www.devze.com 2023-03-28 05:26 出处:网络
Is there a way to catch shift+enter events from android virtual keyboard? For now i am trying to use

Is there a way to catch shift+enter events from android virtual keyboard? For now i am trying to use

private OnKeyListener editTextMessageKeyListener= new OnKeyListener() {
    public boolean onKey(View v, int keyCode, KeyEvent event) {
        if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
            (event.isShiftPressed())&&
            (keyCode == KeyEvent.KEYCODE_ENTER)) 
        {
            addPhoneToList();
            se开发者_JAVA百科ndMessageToUsers();
        return true;
        }
        return false;
};
};

But whenever I press enter or shift-enter, event.isShiftPressed() is always false... This time virtual keyboard shows that shift IS pressed, so somethere inside it there is a shift state maintain - how can i get it? My phone is HTC Sensation with htc sense 3 default keyboard installed.

0

精彩评论

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