问题
I am making custom keyboard.. Now my question is that I want custom popup for key pressed. So, can I change it. popup of key like as this image

If any one know about this then please help me...
CapDroid
回答1:
Yup, its not too hard at all. Just check out the time in the AOSP here.
It's all done in the resource files, here is a short snippet. From the symbols.xml
file of my keyboard project.
<Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="¹½⅓¼⅛"/>
回答2:
It's easy. Just set the android:iconPreview
attribute for the key, where my_icon_preview
is the drawable for the preview popup.
In XML:
<Key android:codes="116"
android:keyLabel="t"
android:iconPreview="@drawable/my_icon_preview" />
In Java:
tKey.iconPreview = getResources().getDrawable(R.drawable.my_icon_preview);
Where tKey
has the type Keyboard.Key
(of course).
来源:https://stackoverflow.com/questions/5988699/custom-popup-for-key-of-keyboard