I have written a simple text editor, using EditText component in Android.
It is working properly on many devices, but on an LG G Pad, text length is limited to 10500 characters ( unicode).
I have set android:maxLength="9999999" but it has no effect!
This Blog should be useful to solve this issue. Basically, use filter.
http://androidblogger.blogspot.com/2009/01/numeric-edittext-and-edittext-with-max.html
Related
I'm building a custom soft keyboard for android and would like to add a layout to include the emoji keys similar to what the default android keyboard (AOSP) is doing. I've searched around but it seems that most people are trying to display custom emoji from images. I'm looking to show the built-in icons that comes with Android (as shown below):
It seems that I should be able to use the Unicode characters to send images from the keyboard, but my first attempt seems to generate only the older versions of the emojis. How do I support the latest emoji the phone can handle? Also, how do I display the emojis in my keyboard as in the image above?
Emoticons-Keyboard
1) instead emitos ,Iam replacing the ImageView containing an asset with a TextView containing a Unicode sequence.
After cross referencing Supported Unicode Sequences as well as the Visual Unicode Database I realized that **u1F601** was a 32 bit Unicode representation, and the 16bit representation can be set like :
EditText messageInput = (EditText) findViewById(R.id.message_input);
messageInput.getText().append("\ud83d\ude01");
2) http://android.appstorm.net/how-to/customization/how-to-use-emojis-on-your-android-device/
Go to https://en.m.wikipedia.org/wiki/Emoji to see which emojis your device supports with unicode.
As you know which emoji is shown depends on the font you use, so to get the latest emojis use NotoColorEmoji.ttf as font for your app.
Thanks for all the suggestions. What I got to work for showing an emoji layout in my custom keyboard was the following:
In the .xml layout file, for each emoji you want to add, create a line like this: <Key android:codes="0x1F602" android:keyLabel="\ud83d\ude02"/>
When committing the key, use: getCurrentInputConnection().commitText(String.valueOf(Character.toChars(primaryCode)), 1);
Emoticon support doesn't work like you think it does. There is no universal set of emojis supported by all android devices, and the emojis your device does support may show differently on different devices. Emojis are done on Android in 1 of 2 ways.
1)Unicode. What emojis the device supports then depends on the font the app is using. You just send the unicode just like you would normal text, and you'd display it on your keyboard by displaying that character. For this method, you guess on which ones the phone will support. And its a total guess, because it depends on what font the app is using.
2)Image spans. You embed an ImageSpannable into the text you send via commitText. The advantage of this is you're sure you have an image (you need to include the images with your app). The disadvantage is it can't be sent to another device, saved, and may not work in all apps (they may not be displaying spannable objects).
Developing for Android via Delphi xe5.Text on TText and TLabel controls are not displaying properly. Seems as if the last line of text is being cut short per character.
This is my issue i believe but not applicable to Delphi xe5
Android: Last line of textview cut off
Here is a QC report I found describing my issue.
http://qc.embarcadero.com/wc/qcmain.aspx?d=121356
Note: The workaround listed in the QC report does not work for me because I am dynamically creating a lot of text controls ( thus can not create in design builder ) and changing the autosize property does not do anything for me.
Any work around or way to resolve this issue? Text displays correctly for iOS, but not for Android.
Thanks !
A short preface. Thai script has vowel signs that may appear above the consonants, and also there are diacritic signs (DS) that also appear above the consonants; when both vowel and DS present, they appear one above other, so the vowel is set above the consonant and the DS is set above the vowel.
I am writing an application that will display text in Thai. Everything looks perfect in the emulator (API 10) but not on the real device (Samsung GT-I9001 with Gingerbread 2.3.6).
I've prepared two pictures to illustrate the problem. I have a simple layout that has the only TextView at the top; two words พี่สาว and ไม้ are displayed in that view.
This is how it should look like (a screenshot from the emulator):
The first character has a vowel and a DS above the vowel, and the last character has the DS only.
And here is a screenshot from my phone:
Both DS have slid down and now the vowel and the DS overlap each other above the first character. Note that the last by one character appears lower than it should (it should be whole line tall like you may see on the first screenshot).
I've found that the problem is system-wide: I've copied these Thai words to a simple web page and loaded it in the web browser in my phone, and got the same problem. It seems like the font rendering is broken.
So the question: how to bypass this? Do I need to install fonts (how?) or maybe some language pack (again, how?), or the only way is upgrading the Android?
PS: no problem on Android 4.0.4. Perhaps only old versions are affected.
Update: WarrenFaith has given a promising advice about setting the custom font. However this appeared to be not as simple as it looks. I've tried several different fonts including Roboto (introduced in ICS), Verdana from the msttf Linux package, and some others. To see that the font is really loaded and applied, I've added some Latin and Cyrillic characters to my text.
The result is funny. Only the Latin and Cyrillic characters change, but not Thai ones. Looks like the fonts don't have the required glyphs and Android replaces them with ones rendered using some default font.
(I don't understand why Roboto didn't work; it's the official Android font—shouldn't it have full support for the whole Unicode?)
So it seems like I have to find the font that has Thai glyphs.
And I'm still wondering what font is used by default in Android 4.0.4.
Happy end: thanks to WarrenFaith's advice, Google, and this blog article.
If the default text/font is broken, you should provide a font you know that will work. To implement the font, you can use the following answers:
Android - Using Custom Font
Using a custom typeface in Android
I am struggeling with the difference of an EditText between any emulator and any device. The EditText does just not display the same. :-(
Can anyone tell me how I can limit an EditText to be just 2 characters wide?
What I did, I created a whole new Android project. I just pulled an EditText into my view and tried to play with all the different maxLength, maxWidth, etc. properties. The EditText would do what I want it to do in the Emulator but as soon as I have the same app on a real device the EditText is always at least 4 or 5 characters wide. Why is this??
I tried it on Android 2.2 and also 2.3
Was anyone ever managed to have an EditText which is only 2 digits wide on a real device? If yes, please let me know how. :-)
use this
text.setFilters(new InputFilter[]{new InputFilter.LengthFilter(2)});
Why can't you fix the width of the edit text and textSize of the editText...?
ex:
<EditText android:layout_width="5dp" andorid:layout_height="wrap_content"
andorid:textSize="18dp"/>
I am trying to setText(string) on a TextView component and I am not seeing the text I set. The input String is larger than 4000 in length(). I find that if I reduce the text size, the text will display.
How can I setText(string) on a TextView with all of the input String visible without changing the text size of the TextView?
Do I have to split the input String and use multiple TextView objects?
How will I know if the input String will be too large and not be seen, as my TextView may be filled with dynamic text?
Let me guess - you have a Samsung phone? Samsung saw fit to modify the operating system to have an implicit maximum size on all TextViews. Why? No idea. But if you specify the length with android:maxLength, it'll work just fine.
See here: How can I debug a seemingly hardware-dependent issue with my Android app without access to the hardware?
I have the same problem with Sony Ericsson Xperia.
I have solved it by using EditText with inputType="none" and editable="false"
I hope it will help you.