Android键盘。 Key的背景 [英] Android keyboard. Key's background
问题描述
我怎样才能设置Android键盘上的每个按键的背景。
KeyboardView机器人:keyBackground 提供的所有密钥一个后台。但我想对于每个键设置不同的背景。
How can I set backgrounds for each key on the android keyboard. KeyboardView android:keyBackground provides one background for all keys. But I want to set different backgrounds for every key.
推荐答案
如果你正在写自己的输入法,请尝试使用绘制的前景图像(与Android:keyIcon中的Java XML或Key.icon)等于到整个键的大小。这基本上相当于设置一个键的背景图像。当然,你也必须包括在图像中的前景。
If you are writing your own IME, try using a drawable for the FOREground image (with android:keyIcon in XML or Key.icon in Java) that is equal to the size of the entire key. This is essentially equivalent to setting the background image of a single key. Of course you will also have to include the foreground in your image.
您也将不得不使用的背景图像与没有填充,所以它不会在边缘周围偷看。看到这个帖子关于如何做到这一点的详细信息:如何做了9patch在为png Android应用工作
You will also have to use a background image with no padding, so it doesn't peek around the edges. See this posting for details on how to do this: how does a 9patch png work in android apps
巴里
这篇关于Android键盘。 Key的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!