I am creating a custom keyboard using KeyboardView class provided in API. I want to change the typeface of the label of keys. (i.e. using kiran.ttf file, 'K' will then Displayed as 'क')
I have searched a lot, but couldn't succeeded yet.
Thanks in advance.
The only real way to do this (and have it output the correct symbol to an EditText when using the keyboard) is to use UTF-8 unicodes. I'm currently developing an engineering keyboard, and I simply found all the symbols I needed, then I output the unicode using getCurrentInputConnection().commitText("\u2220", 1);
In your case, if you were looking for that character you've got in the question, it's unicode is \u0915
Adding that to my keyboard (for demonstration purposes) gives me this:
with the output in the editText near the top of the screen. The key itself is in the top left corner of the keyboard. The specific set of unicode that comes from is called "Devanagari", and the characters can be found here: http://unicode.org/charts/PDF/U0900.pdf.
Hope that helps!
Related
To display the emoji button in the soft keyboard I use this in the EditText:
android:inputType="textShortMessage"
which uses the emoji icons for my device (which may be specific to my carrier/phone model).
I want to use my own set of drawables instead. Is there a way to do this without having to create a completely new soft keyboard?
No, there isn't any single line solution, maybe there is one at Lollipop as it is shipped with emoticons.
Options:
Implement a keyboard (needs a lot of effort + user to change his default keyboard)
Implement a panel/dialog that act as keyboard (needs less effort)
Use an existing library to do so a list of libraries is here but you can search for more if you want!
I was able to solve this by using the EmojiHandler from here:
To get the unicode of the emoji from textual message content:
String s = EmojiHandler.decodeJava(content);
// use decoded string to display emoji in TextView, Button, etc
textButton.setText(s);
To encode the emoji from the softkeyboard and put it into a String:
String encodedEmoji = EmojiHandler.encodeJava(msgText);
I have an editText and I want to make the number and symbols pad (the "?123") as the default input type since the user will mostly input numbers, slashes, and the percent sign.
I've look around the questions here, but those mostly show the number pad instead. I've tried the solution to this problem editText.setRawInputType(Configuration.KEYBOARD_QWERTY); but it shows the number pad on android 4.4.4.
Now I'm stuck because the input types in the xml do not seem to show the ?123 pad. I was thinking of doing it programatically instead but that seems to be a dead end as well.
Any ideas anyone?
There is no way to do that. All you can do is give it the input type. The keyboard itself will decide what to display based on the EditorInfo (which holds the input type and a few other pieces of information) and it will differ for each keyboard- remember that not all phones will use the default keyboard, and some OEMs (Samsung) have their own they replace the default with). Your only real option is to send a numeric inputType, and hope it displays what you want.
Try InputType instead of Configuration. Check this out.
I'm working on an a piano quiz app and I'm at the point where I need to write all the letter notes on the keyboard, more exactly when the user tries to guess what note was played and will press a key the musical letter will appear on that key.
This a screenshot of the app when the user touches a key:
My question is related to the musical symbol flat:
How can I achieve that symbol and implement it in the app? For example dflat is shown as "DB" and I need to rewrite it to "Dflat", flat as the musical symbol.
Edit: The letter notes are shown as text views.
Are you asking whether there is a text character for a flat symbol? If so, check here: http://en.wikipedia.org/wiki/List_of_Unicode_characters
Are you asking how to set the font to one that supports said character? If so, check out the setTypeface() method of TextView: http://developer.android.com/reference/android/widget/TextView.html
You might also consider using icons instead of text.
Edit: The unicode character for the flat symbol ♭ is 266D, and you can use unicode in Java via the \u escape character. Something like this:
sampleText.setText("\u266D");
You have to be using a font that supports that character. And more importantly, so do your users. That's why it might be a better idea to use an icon instead.
Hi i am working on android soft keyboard. Normally labels displayed on
keys are single character as shown below
the above one is done by just using keylabel attribute of Key tag in Keyboard
to display whatever text we want on the key. But now my requirement is to display multiple characters on single key as shown below
I got one solution to this by using android:keyIcon but limitation is I need the color of characters to be configurable so that a user can change color of any character. Like 1 with red, | with blue, q with green. So it must be configurable to any color.That's why I skipped keyIcon property for displaying text on character.
So is there any way to set multiple characters on key.
The standard KeyboardView provided by android framework doesn't support displaying secondary text (or multiple characters). To achieve your desired functionality you need to subclass the KeyboardView(or simply View) and implement its onDraw method and draw directly to the Canvas.
You can check the source code of latinIME KeyboardView where its been implemented using hint label.
Also you need to write your own parser for parsing the Keyboard xml. you can check here how its done in LatinIME.
Understanding the complete package Keyboard in LatinIME will be very helpful for your requirement.
Hi I have done it with by taking reference of Customize the appearance of a <Key>
By playing with given code after three days i have got my solution.
I've been trying to create my own android keyboard following this guide and looking at the latinIME souce code.
While reading the kbd_qwerty.xml file I noticed the different tags used and explained here. I was expecting to see certain tag to reproduce what BetterKeyboard application does. They draw more than one key on each button. Example.
Are they adding images or this is somehow possible from the xml?
Thanks for reading!
Better Keyboard completely rewrote the onscreen keyboard so they can do what every they want with the layout and key functions. With the default Android keyboard you'll need to stick with one glyph per key. Of course you can always use alt's to get other characters.