简体   繁体   English

Android自定义键盘布局作为矢量资产

[英]Android Custom Keyboard Layout as a Vector Asset

I am attempting to create a custom keyboard where a vector image is the keyboard itself. 我试图创建一个自定义键盘,其中矢量图像是键盘本身。 Rather than having a custom xml file in the directory res/xml and defining a Keyboard tag, I want to have solely the image as the keyboard. 而不是在目录RES / XML的自定义XML文件,并定义键盘标签,我想有只图像的键盘。 I wanted to know if this is even possible to do because all of the examples I have seen thus far regarding how to create a custom keyboard is just defining an xml file for the layout of the keys and placing it inside of a KeyboardView. 我想知道这是否有可能实现,因为到目前为止,我所看到的有关如何创建自定义键盘的所有示例都只是为按键布局定义一个xml文件,并将其放置在KeyboardView中。 Any help would be appreciated! 任何帮助,将不胜感激!

No, it's not possible. 不,不可能。 To create a cusotm keyboard you need KeyboardView and Keyboard classes. 要创建自定义键盘,您需要KeyboardViewKeyboard类。

Also, I don't understand why would you need it. 另外,我不明白您为什么需要它。 Do you want a background/theme for your keyboard? 您想要键盘的背景/主题吗? If yes, you can do it like this : mKeyboardView.setBackground(drawable/color) Also, there are other ways to set theme(including key border/background/color etc) for a keyboard, but since you are only concern to learn if it's possible to create a custom keyboard via vector asset. 如果是,则可以这样操作: mKeyboardView.setBackground(drawable/color)另外,还有其他设置键盘主题(包括键边框/背景/颜色等)的方法,但是由于您只关心了解是否可以通过矢量资产创建自定义键盘。 So, the answer is no. 因此,答案是否定的。

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

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