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);
Related
In my Android app i want to search users from server this works fine when i use regular Gboard or English & Indic Languages keyboard. But when i change my phone keyboard to other stylish font keyboard like above screenshot then i can't get any data from server. Same username found when search from regular keyboard.
Is there any ways to convert stylish text to normal text in android app side?
OR
Any change need in sql query on server side for this issue?
You can convert the stylish font text to its equivalent text using the following:
Normalizer.normalize(stylishText, Normalizer.Form.NFKD)
Note:
To err on the side of caution and to remove unnecessary API calls I would suggest (in this particular case of searching) to restrict the user from entering any unwanted characters. You could specify the digits that can be inputted into the EditText like so:
android:digits="0123456789abcdefghijklmnopqrstuvwxyz "
Don't remove the space at the end so that the user can enter blank spaces
I want to show digits "0123456789/" on keyboard if open on click of SearchViewbut I don't know how it can be done. I am able to set InputType to a searchview like this
searchView.setInputType(InputType.TYPE_CLASS_NUMBER);
but not able to set custom digit to show on a keyboard.
from input type InputType.TYPE_CLASS_NUMBER numeric keyboard is opening but i also want to show "/" also with numeric digits 0123456789.
I searched a lot on SO but didn't find any solution for this.
There is no easy solution for this. You have two options depending on what you can work with and what exactly you want.
If it is exactly as you say in your question, that is, to SHOW
just the Characters that you specify, then the way to go about doing
that would be to create a Custom SoftKeyboard. This will allow you
to take only the desired inputs and will show only those characters
that you have specified.
Otherwise you can disable taking other
characters input (that are not to be available), by working with
[onQueryTextChanged]1 where you manipulate to resend only the
values that you can take in as input. Here the default
softKeyboard is used, but the input taken in by the SearchView are
as per specification.
Note : my knowledge is mainly based on working with EditText rather than SearchView, so not able to provide exact codes for the above
I know that you can specify a short message input type in order to turn the enter key of the keyboard into an emoji button and pressing it will show up the emoji list but what i want to do is open up the emoji list programatically from a button. Is this possible?
There is no functionality to add tabs to any generic keyboard. Certain keyboards may support it, but it isn't a common feature. You could write your own fully custom keyboard, but that's a lot of work and will piss off many users.
Also, I'm not sure what you mean about by like in hangouts. I use hangouts- it doesn't do anything odd with my keyboard. It stays as Swype, there's no special emoji tab. It may be a feature of your favorite keyboard based on the input type (I assume both use input type textShortMessage). But it isn't a generic feature.
See Link Android Keyboard with Emoji
Thanks and enjoy...
Is there any way to input special characters (which are not present in the default soft keyboard ,eg. theta) in an Android EditText?
Thanks..
Well as per your need, I would like to suggest to create a custom keyboard because the stock keyboard which comes with the device may not have the special characters you need.
You can refer the following tutorial to create a custom keyboard
http://www.fampennings.nl/maarten/android/09keyboard/index.htm
or you can see this search result which may serve your purpose,
https://github.com/search?q=android+custom+keyboard&ref=cmdform
And from below site you can get the list of Unicode characters which Android supports,
http://en.wikipedia.org/wiki/List_of_Unicode_characters
http://unicode-table.com/en/#0026
Note: Writing the whole code to create a custom keyboard is beyond the scope of this answer, so I mentioned the reference link.
What you are going to do is to create a custom keyboard. First thing you want is to hide the default keyboard when an EditText is focused:
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Now, you must create a custom layout (RelativeLayout or Multiple LinearLayouts this is your desire), create and set text to the buttons that you want to show. Make this keyboard view setVisibility(View.INVISIBLE) or setVisibility(View.GONE), and whenever your EditText is focused, make it setVisibility(View.VISIBLE).
After keyboard is visible, programming the rest is up to you it is practically easy.
If you also need a guide, here is an example.
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.