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
Related
I am writing an view where I need to display superscript data. I am following this to achieve this.
Along this is there any way to change font size(in number) of superscript text.
EDIT
Commanware suggested link work great, except one thing. I need superscript bit above of base text. I'm updating image for same, please refer. I'm using same code with mention in reference code.
Here either can go for separate text view could be second priority solution. Any suggestion !
try this one this is working code:
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("04:30<sup><small>pm</small></sup>"));
you cant pass text size in numbers, yo have to change the size to string :
<font size="3" color="red">This is some text!</font>
Use this Code :
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("your Text <sup style="font-size:5(yourfontsize);">subscript</sup>"));
Try this and Let me know :)
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.
I have a long string, with multiple bold words inside the string.
The styling of the non bold sentences are done inside the TextView XML part and this is looking fine.
But i want to make the bold words bigger and thicker.
Is this possible to change this with XML?
for example:
<string name="long_text">This should be a <b>long</b> text with different <b>styling</b></string>
The bold words are supposed to be 1.5 times bigger
Or should i do this in the Java code?
yes you have to do this in java because there is no way to as per your requirement,
you can use TextAppearanceSpan in java code with Spannable
if i am getting you right than try the following..
textview.setText(Html.fromHtml(getResources().getString(R.string.long_text)));
Mark as right if it works for you .
I have problem on Android to do rainbow programmatic color on TextView.
Here specific condition of TextView:
String on TextView may contain character and number in unspecific order.
Example: AA11BB22, X2YY3ZZA1
For character (A-Z), I wish to display color BLUE.
For number (1-9), I wish to display color RED.
Example: AA11BB22 will display 'AA', 'BB' will display BLUE, and '11', '22' will display RED in TextView.
I know, there few solution to do solve using generate Image or HTML on canvas.
Is better or worse to do generate TextView for each chunk of part then color it?
Or maybe your guys has elegant solution for my situation.
Thanks.
You can make use of Spannable. This link will help you to understand how to use Spannable http://www.chrisumbel.com/article/android_textview_rich_text_spannablestring
You should have a look at Spannable string. http://developer.android.com/reference/android/text/SpannableString.html. The link provided by android.fryo is good and has a complete example.
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>