this is my hebrew content :
<string name="test">בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃</string>
When i display in textview it is display correct format. But when i display in webview it display wrong.
I used this but not any effects DIR='RTL' LANG='HE' ALIGN='JUSTIFY' in html. I want to display in webview.
It is a known bug in WebView with strings that include nekudot (vowels). Note that it appears to have been fixed in Ice Cream Sandwich (Android 4.x) and above.
Related
I am developing an application in Android. I want to show Hindi text for EditText, Buttons, textview, webview
and also I need to get data from json parsing and store in Sqlite.
i have checked many sollutions but the following issues arise
Normal words in hindi can be rendered properly like सरल
the problem arises in words like नित्य
also words like प्र
My questions are
1) which ttf file should i use
2) which min sdk should i target
3) will the sqlite database support unicode
4) how to display data in webview it gets all messed up
is there a simple solution than using
TextView t = (TextView ) findViewById(R.id.hindi);
Typeface face=Typeface.createFromAsset(getAssets(),
"fonts/hindi.ttf");
t.setTypeface(face);
t.setText("Hindi font");
everywhere for textview like setting up a common file to call in res folder like we call strings.xml
I found these ttf available on this link
Android Fonts TTF
try give it a go :)
For the second question the minSdk looks like to be API14 from what I read on this link
Android 4.0 APIs
I know, I am bit late here but this is a known bug for android. You may like to see this thread
I am developing an android application and I strongly need to use Justify text alignment and also I should use custom font for texts. my application is in Persian language.
If I use TextView for showing texts I cant set text alignment to Justify.
If I use WebView and load html to it I cant use font for it (I know that I can set font using html and css but it does not work for some languages like Persian and Arabic , I tested it, only on android 4.4.2 i see my custom font but on other versions of android webview show android default font)
I tried converting font to SVG but nothings changed.
also I searched in github for a custom webview or textview , I fount one custom textView , both font and text alignment was ok but the direction was left to right but i need it be right to left (I tried changing gravity and other things but cant fix problem).
So what is your suggestion ?
Thank you so much for helping.
Regards.
Take a look at this forum.I used this library with the following attrs and everything works perfectly:
ext:documentView_reverse="true"
ext:documentView_textAlignment="justified"
ext:documentView_textFormat="formatted"
I am working on an application that will work on Android WebView. I enabled the selection and copy for this view. In some devices that support Arabic, When I paste the copied text from WebView in any EditText view, It shows me the reserve text. but In some cases it shows me the correct form.
Could any one please help me to show in correct form in all devices ? :-/
I have red all threads that depend on supporting Arabic and Farsi Text, but I can not reach my purpose.
Thanks in advance :)
You can pass your copied text to FarsiLibrary. It will analyses your text letters and justify them according to their possible 4 states (Initial, Middle, End, Isolated) :
Initial like 'ن' in 'نازک'
Middle like 'ن' in 'هنر'
End like 'ن' in 'وطن'
Isolated like 'ن' in 'ایران'
Android has Added support for RTL in Native widgets(i.e TextView , EditText) . so if u run the app onward 4.2 u will get RTL feature automatically ,
http://android-developers.blogspot.com.es/2013/03/native-rtl-support-in-android-42.html
You can create different versions of the layouts for different API versions.
As you can read here: http://developer.android.com/guide/topics/resources/providing-resources.html you can have say the normal folder (/res/layout/) with the layout for old devices and then another one for the ones that support it: /res/layout-11/
The layout inside layout-v11 will only be applied on devices with android 3.0 and over.
I have done an app to show tamil data on text view to putting elcutni.ttf in android asset folder for that. Then I made a fonts folder by using
Typeface tf = Typeface.createFromAsset(this.getAssets(),"fonts/vigyapti.ttf");
txt.setTypeface(tf);
I am showing tamil data on text view a sample tamil data is taken from random site and store it in the strings.xml file. How can I show data on text view and dialog box of indic fonts? Please help me to make app which contains all indic fonts. Please help me to show indic font data on dialog box and text view.
It seems like you are on the right way, although maybe not the correct font. Have a look at this post to see if it helps:
http://lkalarani.blogspot.com/2011/04/tamil-in-android.html
Also, what is exactly the problem with the code you posted? Do you get an exception? If it's not correctly rendered, have you got any screenshots?
I am porting an app that displays Hebrew to Android 2.3. The 2.3 emulator displays the strings correctly when in a TextView, but when I try to put the strings in a WebView, the webview just displays gibberish.
This tells me that the Hebrew fonts are available in the emulator but the webview code has something missing.
This is the code:
WebView mWebView = (WebView) findViewById(R.id.webview);
mWebView.loadData("<html><body>"+temp1 +"</body></html>",
"text/html", "UTF-8");
Any ideas on how to get the emulator to display the webview correctly.
When you display the page, you aren't giving a way for the browser to know that your page uses a right-to-left script.
You can use the HTML dir attribute in a markup element that surrounds your right-to-left text (it should detect automatically which characters to reverse, and which not to). (For more details, look at this note from W3C - it seems to be implemented in Chrome at least.)
Probably the most expedient way would be to rewrite the first tag as:
<html dir="rtl">
I changed the font of the webview by adding
mWebView.getSettings().setFixedFontFamily("DroidSansHebrew.ttf");
The text is rendered in the correct font but left-to-right which is not the correct orientation for Hebrew.