Android Custom keyboard

廉价感情. 提交于 2019-12-01 13:44:58

I find my own answers,it simple i just to add one same button in all xml file like

in hexkbd : in key tag

        android:keyEdgeFlags="right"
        android:codes="35"
        android:isRepeatable="true"
        android:keyIcon="@drawable/img_change_key" 

in hexkbd2

        android:keyEdgeFlags="right"
        android:codes="38"
        android:isRepeatable="true"
        android:keyIcon="@drawable/img_change_key" 

and in CustomKeyboard class KeyboardActionListener decalare :

        public final static int ChangeKey1 = 35;
        public final static int ChangeKey2 = 38;

and in CustomKeyboard class onKey() event :

        ...else if (primaryCode == ChangeKey1) {

            mKeyboardView.setKeyboard(new Keyboard(mHostActivity,
                    R.xml.hexkbd2));

        } else if (primaryCode == ChangeKey2) {

            mKeyboardView.setKeyboard(new Keyboard(mHostActivity,
                    R.xml.hexkbd));

        }

done,it simple,but my confusion take time,i share my idea to help to other persons.i think this helpful to others.

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