Nir Patel
Nir Patel

Reputation: 367

Merging Popup characters on a custom keyboard

I am working on a custom keyboard which has alot of popup characters on different words.

For ex : u -> ü

To define popup character we just write a simple property as below :

<Key android:codes="117" android:keyLabel="u" android:popupCharacters="ü" android:popupKeyboard="@xml/keyboard_popup_template"/>

And we get a popup character output as below : enter image description here

For multiple popup characters on a single long press, I wrote code like this :

<Key android:codes="110" android:keyLabel="n" android:popupCharacters="ŋñ" android:popupKeyboard="@xml/keyboard_popup_template"/>

And got output as below :

enter image description here

It means that, popupCharacters property seperates each character we write in it. Now the problem is I want to merge two characters to indicate power value.

For ex :

So I wrote as below :

<Key android:codes="113" android:keyLabel="q" android:keyEdgeFlags="left" android:popupCharacters='qʷ'  android:popupKeyboard="@xml/keyboard_popup_template"/>

But it obviously seperated both characters in popup.

enter image description here

How can I use it as one characrter without seperating it..??

Note : I have already tried using unicode and escaping characters but it does not work.

Upvotes: 2

Views: 379

Answers (1)

sanjeev jadhav
sanjeev jadhav

Reputation: 1

I was struggling with the same issue and found out, if u include the [row] in the layout[keyboard_popup_template] itself it would not merge the characters but would achieve the same goal....lets c how

your eg.->

. . now, here don't include android:popupCharacters='qʷ'

so it would look like:- . . and in android:popupKeyboard="@xml/keyboard_popup_template" add row in which your label and output would be qʷ

so, @xml/keyboard_popup_template would look like :-

<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="56dp"
android:codes="100"
>

<Row android:rowEdgeFlags="top" >
    <Key android:keyLabel="qʷ" android:keyOutputText="qʷ"             
android:keyEdgeFlags="left" />
    <Key android:keyLabel=":-(" android:keyOutputText=":-( "/>
    <Key android:keyLabel=";-)" android:keyOutputText=";-) "/>
    <Key android:keyLabel=":-P" android:keyOutputText=":-P "/>
    <Key android:keyLabel="=-O" android:keyOutputText="=-O " 
android:keyEdgeFlags="right" />
</Row>

</Keyboard>

Upvotes: 0

Related Questions