Android textview incorrect linebreaking - android

Below is some text from a textview (background is red for emphasis on the boundaries).
As you can see, the word "the" before "digital generation" should have been in the previous line since there was enough space. Is there any way to make TextView render it correctly?
I tried android:breakStrategy="high_quality" without luck.

Looks like adding android:breakStrategy="simple" solves it

Related

TextVIew does not display "ț" symbol

I have a simple TextView, where I put a string like that: "Curăță corect urechile copilașului tău!". But I see the string on display like this "Cură ă corect urechile copilașului tău!" - just space between chars, where must be a "ț" symbol.
I checked the string in TextView by TextView.getText(), and I get my original string.
This is a screenshot, also the same problem in first title:
Try to set text in TextView using HTML. I hope this will work and may help you out.
myTextView.setText(Html.fromHtml("your_string"));
There is still space for the letters, so perhaps it's an issue with the styling.
Change the style to default, do the letters show up?
Try adding a shadow to the textviews and see if the shadow exists (maybe the letters are somehow transparent, or the same color as the background?)
It is more related to a font issue, default Android font doesn't support some characters. You need to try from a different font.
You can try from the following (but I think its not free)
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=FontDownloads

Android TextView custom typeset causes gravity to stop working

Update
This only appears to be happening with Roboto-Italic.ttf. If you're running into this issue, try another font family.
I'm running into an odd issue when applying a typeset to a TextView. The app name, "Contact" is in a LinearLayout with android:gravity="center" set, which causes it to be centered nicely as seen in the "Before" image below. When I set the typeface, it causes the gravity to stop working for some reason. This is how I'm setting the typeface:
tvAppName.setTypeface(
Typeface.createFromAsset(getActivity().getAssets(),"fonts/Roboto-Italic.ttf"));
Any idea why this might be happening? I've tried setting the gravity programmatically, but that didn't help. Commenting this one line causes the text to go back to being centered.
Before
After
The Roboto-Italic.ttf file from Google's website seems to be broken or incompatible in some way. Work-around is to use the normal Roboto font but specify italic as the 2nd argument:
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Normal.ttf"));
tvAppName.setTypeface(tf, Typeface.ITALIC);
What this does is fake the italics by putting a skew on the text. So it theoretically does not look as nice, but it solves the problem of gravity and other layout attributes not working with the real Roboto Italic.

Character spacing for "1" in a textview

I'm using a Digital-7 Typeface for a pair of TextViews. The problem with the TextViews is that whenever I use the character "1" in it, the characters left of the "1" get pushed back and they lose their proper spacing. As seen here:
You can see the 9's are properly in place while the 1's get squished together. Is there any piece of code that can help me fix this or do I need a better Typeface?
As what Der Golem said, switching to a monospace Typeface fixed my issue.
Please try this property in XML, Hope it will work.
android:textScaleX="1.2"
Must be a floating point value, such as "1.2". You can change the value depending on your requirement.

Android textview wrap around textview

Is it possible to wrap a textview around a textview, where the 2nd textview would wrap to the next line under the first textview?
For example:
<This is one textview> <This is
another textview>
I have tried using android:layout_weight="1" and relative layouts, however, they dont produce this effect.
No. If you're looking to format the two bits of text differently, consider using spans within one TextView.
This will be helpful to you. You can get same effect with HTML in text view
How to display HTML in TextView?
This is impossible because the "another textview" would have a non-rectangular widget area then.

android making superscript text in textview got cutted

i have a layout containing multiple TextViews containing text with superscript... to make a portion superscript in text i have used <sup>superscript text</sup> tag in string.xml within text the problem here is my text got cutted in emulator view i have also tried to add padding but output is same nthing is working for it like , changing margin,padding,font size...please help here below is image what i get on emulator........
Make it like this.
< sup>< small>superscript text< /small>< /sup>
A further problem remains: the superscripted text is not properly scaled, i.e. font size reduced.
So padding is just a weak solution to a bug in the proper rendering of a [super|sub]script.
I am investigating a fix for this...will see.
if you want small superscript text than you can use
<sup>< small>text< /small>< /sup>
if you want to more small than you can use <small> tag twice like below
<sup><small><small>text</small></small>< /sup>

Categories

Resources