表情符号键盘显示时调整键盘大小或隐藏虚拟键盘

时间:2017-08-03 04:03:38

标签: java android keyboard emoji

我正在使用SuperNova-Emoji库。我尝试了许多解决方案来调整表情符号键盘的大小,或者在表情符号键盘显示时隐藏虚拟键盘,但没有任何效果。

the keyboard emoji

这是GitHub中的库链接:
https://github.com/hani-momanii/SuperNova-Emoji

更新1:

这是我的代码;而问题现在是一个infinie循环;键盘显示和隐藏所有时间,没有停止

SendMessageBox = (EmojiconEditText)findViewById(R.id.txtSendMsg);
    emojiIcon = (ImageView)findViewById(R.id.btn_icon);
    SendMessageButton = (Button)findViewById(R.id.btnSendMsg);
    rootView = (RelativeLayout)findViewById(R.id.layoutbackgrounde);
    EmojIconActions emojiAction = new EmojIconActions(getApplicationContext(),rootView,emojiIcon,SendMessageBox);
    emojiAction.ShowEmojicon();

    emojiAction.setKeyboardListener(new EmojIconActions.KeyboardListener() {
        @Override
        public void onKeyboardOpen() {
            Log.e("Keyboard","open");
            InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(rootView.getWindowToken(), 0);
        }

        @Override
        public void onKeyboardClose() {
            Log.e("Keyboard","close");
            //maybe re-appear the input keyboard if you have to on emojikeyboardclose
            //InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            //imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
        }
    });

1 个答案:

答案 0 :(得分:1)

您可以在emojikeyboardopen上隐藏原始键盘:

emojIcon.setKeyboardListener(new EmojIconActions.KeyboardListener() {
    @Override
    public void onKeyboardOpen() {
        Log.e("Keyboard","open");
        InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }

    @Override
    public void onKeyboardClose() {
        Log.e("Keyboard","close");
        //maybe re-appear the input keyboard if you have to on emojikeyboardclose
        //InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        //imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
    }
});