Question

We're trying to build a SoftKeyboard for an android app. The characters to be shown on the keyboard are asian language characters.

Any pointers will be helpful.

Was it helpful?

Solution 5

We ended up using button icons. This seems to be the most straight-forward way.

OTHER TIPS

Actually, it depends on wether the characters you will be using are supported (displayable) in the android system font.

If they are, simply use the unicode codes in your keyboard xml definition, e.g.:

<Key android:codes="946" android:keyLabel="\u03B2"/> 
<Key android:codes="946" android:keyLabel="&946;"/> 
<Key android:codes="946" android:keyLabel="β"/>  
<!-- Warning, you should use UTF-8 encoding for your project files if you use the third solution -->

all produce the same key with greek β character (unicode \u03B2, decimal 946)

If they are not, then your only solution is to use icons: the keyboard character Typeface is hardcoded in android KeyboardView.java source code (method onBufferDraw()) and defaults to Typeface.DEFAULT_BOLD

I have no experiance in Android, but much more in Java ME. In case of mobiles, and also in desktops, it is not possible for unicode charactor to render exactly as required as it is the font dependable. The font used for rendering the text must have the said charactor code in it, else a ? or dark rectangle will be displayed. Your best solution seems the image fonts (icons you are currently using).

I'm also working on a softkeyboard and using hashmap for mapping bangla characters with codes, typeface enabled me to use bangla font for candidate view but no luck with keyboard keys (it needs to inastall font in system by rooting), still suffring from complex font rendering, glyphs are shown as broken characters, currently using SQLite database for prediction, if you know how to use .dict for prediction please let me know :).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top