自定义弹出键盘键

时间:2011-05-13 07:32:36

标签: android soft-keyboard

我正在制作自定义键盘.. 现在我的问题是我想要按键自定义弹出窗口。 那么,我可以改变吗? 像这个图像一样的关键弹出

enter image description here

如果有人知道这一点,请帮助我......

CapDroid

2 个答案:

答案 0 :(得分:3)

是的,它根本不太难。只需查看AOSP here.中的时间 这一切都在资源文件中完成,这是一个简短的片段。来自我的键盘项目的symbols.xml文件。

<Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"
     android:popupKeyboard="@xml/kbd_popup_template"
     android:popupCharacters="¹½⅓¼⅛"/>

答案 1 :(得分:1)

这很容易。只需设置密钥的android:iconPreview属性,其中my_icon_preview是预览弹出窗口的可绘制对象。

在XML中:

<Key android:codes="116"
     android:keyLabel="t"
     android:iconPreview="@drawable/my_icon_preview" />

在Java中:

tKey.iconPreview = getResources().getDrawable(R.drawable.my_icon_preview);

tKey的类型Keyboard.Key(当然)。

相关问题