i am going to set mix text on edittext like:Xyz Pvt Ltd فاتورة المبيعات مبيعات التسليم <0x09> Choclate Cake 10 x30.000 = 300.000
Acualy i had set text like this but arbic text chage it Xyz Pvt Ltd ف اتورة المبيعات مبيعات التسليم -Choclate Cake 10 x30.000 = 300.000
As you can see in first line after arbick text i had append <0X09> but it will append before arbick text that's proble
You can try to convert the unicode to arabic type with a convertor online and then setText the view with arabic font. For tamil I had used TAB font so I downloaded the tab font and had put it in my assets folder and then in setTypeFace I used the font. You can try the arabic encoded string and the font.
String EncodedString = "Üî¢î¤ò£òñ¢ : "; // Your arab encoded string
Typeface tfTab = Typeface.createFromAsset(getAssets(),"fonts/tabkovai.ttf"); // Replace with arab font
tab.setTypeface(tfTab);
TextView.setText(EncodedString);
Related
I am creating a Gallery application. Each image will show the title along with the name of the person who uploaded the image. Example of what I want is below:
Here the Night is dark, but this darkness has the silence is the title for the image, and the shaggy boy is the user who uploaded the image for example.
So, now I want Night is dark, but this darkness has the silence to be in the separate textview and the shaggy boy at the end of the Night is dark, but this darkness has the silence's textview even if Night is dark, but this darkness has the silence is a single line or multi-line.
I have used the Flexbox Layout but I am failed to achieve what I want.
How to append the textview to the end of another textview? Thanks!!!
You can use a single TextView and set its text String with a Spannable and match each portion of text with indices here I am separating both portions by a hyphen; but you can change that as you would like.
TextView textView = findViewById(...);
String tag = "Night is dark, but this darkness has the silence - shaggy boy";
SpannableString spannableString = new SpannableString(tag);
spannableString.setSpan(new ForegroundColorSpan(Color.BLACK), 0, tag.indexOf("-"), 0);
spannableString.setSpan(new ForegroundColorSpan(Color.GRAY), tag.indexOf("-"), tag.length(), 0);
textView.setText(spannableString);
Maybe you could just get the text of the author's TextView and add it to the String of the first TextView?
You can use a single TextView with String palceholders of the quote and the author, and add the colors using HTML tags.
strings.xml
<resources>
<string name="tag">
<![CDATA[
<font color="#00000">%1$s</font> -
<font color="#D3D3D3">%2$s</font>
]]>
</string>
</resources>
Behavior:
String message = "Night is dark, but this darkness has the silence";
String name = "shaggy boy";
String formattedTag = String.format(getString(R.string.tag), message, name);
textview.setText(Html.fromHtml(formattedTag));
in Android I would like to concatenate number with Arabic text. but if i concatenate the number then the arabic text direction changes.
Example: My Application reads each line of arabic text from file and adds the line number to each line and appended to string builder , After completion of reading final string will be displayed on text view.
Here is my code
SpannableStringBuilder styledString = new SpannableStringBuilder(TextUtils.concat(l,"("+sn+")"));
styledString.setSpan (new CustomTypefaceSpan("", type), 0, l.length()-1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
// styledString.setSpan(new AlignmentSpan.Standard(Layout.Alignment.ALIGN_OPPOSITE),l.length()-1,l.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
spannablestringbuilder.append(styledString);
Expected Output:
(3) ﺑِﺴْﻢِ ٱﻟﻠَّﻪِ ٱﻟﺮَّﺣْﻤَٰﻦِ ٱﻟﺮَّﺣِﻴِ(1)ٱﻟْﺤَﻤْﺪُ ﻟِﻠَّﻪِ ﺭَﺏِّ ٱﻟْﻌَٰﻠَﻤِﻴﻦَ (2) ٱﻟﺮَّﺣْﻤَٰﻦِ ٱﻟﺮَّﺣِﻴﻢِ
Actual Output
(1)ﺑِﺴْﻢِ ٱﻟﻠَّﻪِ ٱﻟﺮَّﺣْﻤَٰﻦِ ٱﻟﺮَّﺣِﻴﻢِ (2)ٱﻟْﺤَﻤْﺪُ ﻟِﻠَّﻪِ ﺭَﺏِّ ٱﻟْﻌَٰﻠَﻤِﻴﻦَ ٱﻟﺮَّﺣْﻤَٰﻦِ(3) ٱﻟﺮَّﺣِﻴﻢِ
Try
Removing spaces
Use hyphens - instead of spaces
Try finding a way to change the direction
By the way, this question is answerde here and might be a duplicate!
Thanks for posting!
i have used many punjabi fonts as like bulara_f.ttf , anmollipi , Akaash and many more but every time prolem with one word of punjabi "sihari"
Sihari : Sihari is equivalent to i in pin or thin. Hence forth in this module we will denote sihari vowel with /i/.
in my application only this one word is not shown properly as like in following snapshot... please help...
EDIT
i am using this method
Typeface myfont;
myfont=Typeface.createFromAsset(getAssets(),"font.ttf");
TextView textview = (TextView)findViewById(R.id.TextView01);
//textview.setText("punjabi Text");
textview.setTypeface(myfont);
}
Use bulara_5.ttf and run the code on device it will show correct punjabi words
mTvAbout = (TextView) findViewById(R.id.tv_about);
font = Typeface.createFromAsset(this.getAssets(), "bulara_5.ttf");
mTvAbout.setTypeface(font);
mTvAbout.setText(" ਜਾਣਕਾਰੀ");
I am developing an android App in Hindi but find that few characters are misspelled and broken in Hindi the issue is in http://code.google.com/p/ankidroid/issues/detail?id=1008 but no solution there दिप is rendered as दपि
letters in hindi font above are formed as द + ि + प which should display as दिप but It render as दपि
The same question was put earlier but not resolved so I had to repost it again
Correcting Hindi (Unicode) rendering in Android
Finally I found the solution this is very simple just import the font in my case I am developing web app
#font-face { font-family: hindi; src: url('fonts/k010.TTF'); }
body,h1,h2{ font-family:hindi; }
then type text in your a text editor or MS-word using Kruti devi10 font after You finished change the font to Arial and paste the text in your web App and it will render perfectly
you can use Unicode ...
TextView tv=(TextView)findViewById(R.id.textViewmyView);
final Typeface tf = Typeface.createFromAsset(this.getAssets(), "Hindi-SARAL1.TTF");
tv.setText(Html.fromHtml("&# 2367;&# 2342;&# 2346;"));
tv.setTypeface(tf);
unicode value continues no gap.....
and you can also convert world to unicode via this site...http://mylanguages.org/converter.php but in case of इ 1st use unicode of इ then alphabets Unicode...b/c till android version 4.0 Hindi Unicode not supported proper..
In Unicode characters the ARABIC LETTER PEH INITIAL FORM 'ﭘ' is 0xFB58. When I use the following code to show Unicode characters, everything is OK for every Unicode character in Android 2.2, 2.3. and 4.x But I have problem with ARABIC LETTER PEH 'ﭘ' on Android 3.x and in this case character '~' is shown.
Typeface tf = Typeface.createFromAsset(context.getAssets(),"TAHOMA.TTF");
strChars = "";
strChars += (char) 0xFB58;
tvChars.setTypeface(tf);
tvChars.setText(strChars);
I should mention that The problem is remained when I change the font or ignore using setTypeface(tf)
Why?
How can I find the code of ARABIC LETTER PEH in Unicode?
EDIT:
Please compare 0xFB58 (ﭘ) and 0xFB5E (ﭞ) with any font programmatically. you will find the problem. the first one is not shown but the second one is shown correctly.
Did you try adding your own fonts?
Get a Persian TTF font file that fits you and use it, this way you won't be OS dependent.
http://twigstechtips.blogspot.com/2012/01/android-how-to-use-true-type-fonts-ttf.html