Android Custom keyboard

2019-02-20 18:15发布

I creating custom keyboard using this link "http://www.fampennings.nl/maarten/android/09keyboard/index.htm" but i want to include so many word into this keyboard,above link keyboard looks like follwing :

enter image description here

i have three xml file : 1) hexkbd : have A to N 2) hexkbd2 : M to Z 3) hexkbd3) extra word, i display first xml file well, but i want to put one extra button into this keyboard to change above all three xml to change keyboard a to n to m to z, but i dont know how to do this in this custom keyboard.for example in above image i put number in another xm file,alphabet in another xml file, and other extra word in another file, we put same one button in all this xml file to change all three sequential,in first click on this same button display only number keyboard,second click alpha keyboard as all,what i have to do in this button and how, any one please help me quick ? thanks in advance.

i want following type : enter image description here

1条回答
Lonely孤独者°
2楼-- · 2019-02-20 18:39

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.

查看更多
登录 后发表回答