简体   繁体   English

切换键盘视图的代码Android Studio

[英]Code for switching keyboard view android studio

I am creating a custom Android keyboard at the moment. 我目前正在创建自定义的Android键盘。 I have the letter page completed, but I do not know how to create a button that will switch to the symbols view. 我的信函页面已经完成,但是我不知道如何创建一个将切换到符号视图的按钮。 I want to click the 'Sym' button and switch the view to symbols. 我想单击“符号”按钮,然后将视图切换为符号。 What methods should I be using etc? 我应该使用什么方法等?

http://imgur.com/a/I7Lw3 http://imgur.com/a/I7Lw3

Thanks in advance! 提前致谢!

You can specify your "Sym" key with code like 您可以使用以下代码指定“ Sym”键

<Key android:codes="-2" android:keyLabel="Sym"/>

and make action to your keyboard.java using onKey method 然后使用onKey方法对您的keyboard.java进行操作

            case Keyboard.KEYCODE_MODE_CHANGE:
            keyboard = new Keyboard(this, R.xml.symbols);
            kv.setKeyboard(keyboard);
            kv.setOnKeyboardActionListener(this);
            break;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM