5

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

enter image description here

If any one know about this then please help me...

CapDroid

Niranj Patel
  • 32,980
  • 10
  • 97
  • 133
  • hi CapDroid i am working on soft keyboard, have you succeed to create custom pop up.Because i just need to customize default pop up window.I had posted my question here "http://stackoverflow.com/questions/20299210/customize-soft-keyboard-key-preview" – Aniket Nov 30 '13 at 10:50

2 Answers2

3

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="¹½⅓¼⅛"/>
Nathan Schwermann
  • 31,285
  • 16
  • 80
  • 91
1

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).

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Barry Fruitman
  • 12,316
  • 13
  • 72
  • 135