Arabic Font in android webview? - android

We have site urls having arabic language we want to display as it is in android webview but it is not showing as correctly it is showing in reverse. Can you help me????

There is a simple solution of it. As correct order letters display in reverse order. Why not we write reverse letters?
This link will help https://stackoverflow.com/a/13562693/1547539

Just set the encoding :
YourWebView.loadData(YourContentHtml, "text/html; charset=UTF-8", null);

I fully understand your issue, you mean:
[أحمد] Would show as [دمحا]
I am afraid this is not possible, I have seen some post around all confirm that can't be done in the mean time.
Android has the ability to use custom TTFs in views (though it's kind of a kludge, example on how to use custom typefaces in the API Demos), but I'm not sure how to extend this to WebView, or whether it's even possible. custom font with Webview
Also see: font face of Webview in Android?

Related

How to listen onClick events on complex Images on Android

I have the following image:
I need to change the color of the circles once it is clicked.
The image is a SVG
Should work on Android API 17+ and if possible for tablets as well
What is a smart/effective way to achieve that?
The possible solution I have until now are:
Break it in small clickable parts(Not good, there will be lots of images, other body parts will be required to do the same)
Use a Webview with Javascript to change the colors.
Any other suggestions?
One option is to use WebView and handle with these click events you need using javascript or even JQuery. You just need to put ID or classes.
$("#cicleButton1").click(function() {
});

MathJax with TextView in Android

I have some data which was formatted using MathJax on WebApplication. Now, I want to display those Data in Android App and that is in TextView only.I have already downloaded MathJax from Leathrum's WordPress
I found some examples but all are using WebView. But I want it using TextView. How to get this ???
I am also using ImageGetter with that TextView and it is working fine. Now, just want to do something for MathJax.
Why only TextView ???
My data contains simple text, html text, images, and math functions... I was using webview but it is showing extra space at bottom and also have using with Webview because I am using Custom ListView with WebView
But I want it using TextView. How to get this ?
You don't. TextView is not designed for this. Your choices are:
Stick with WebView
Figure out how to render your mathematical expressions to images, then either use an ImageView, ImageSpan, etc.
Write your own widget that draws the mathematical expression to a Canvas
MathJax is a cross-browser JavaScript library that displays mathematical notation in web browsers, using MathML, LaTeX and ASCIIMathML markup.
Source: MathJax in Wiki
The very first line has an answer for you. It's a cross-browser javascript library. you can not use it for textviews. Doesn't it make sense ?
Update:
Solution 1: You could write a mapper which will have mapping of each Math symbols to its html code and use it to showcase on your TextView based on need.
Solution 2: There is a nice open source: MathView Which is using MathJax internally that you can use.

display html content without using webviw in android

I wan to display html contents without using webview in android.
Contents are result of html parser.
But by now, I don't know how to do it. Is there any clue or example?
I think I need some example code to study it.
thank you very much.
You have to use Html.fromHtml()
Example :
myTextView.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>"));
Best Example here.

Create a nice "About" XML Layout using rich text?

I intend to make a good "About" section in my application that gives the user some basic information about the developer and the app itself.
I didn't find a rich EditText among the Widgets.
I have searched for other questions similar to mine here and I found something like using a WebView or a TextView and giving them HTML attributes in the code.
Is there any nice and professional way to do my About XML Layout?
use multiple TextViews and position them accordingly.
If you need high control and rich text, use a WebView and load a static HTML file. You can achieve a lot with Spans (bold, itallick, links, etc.) in a simple TextView as well but it is generally more work.

Android: How to load a page into a WebView and then apply some custom css to it?

I need to load a page into a webview and then apply some custom css to it. This page is not under my control, so I can't simply add a CSS include or inline CSS within the page itself.
Right now I'm just doing an HTTP get request, putting the contents into a String, prepending the string with my custom css (in style tags), and finally doing a loadDataWithBaseURL() on the string.
Is there a more elegant/efficient solution?
Thanks!
Well using what is available in the Webview, you have probably done the best that could be done.
However, if you really want to do it elegantly, get the source codes of WebView and all the classes it needs. Alter them to ultimately add the function WebView.setCSS() (for example)... It is doable but it needs some time.
you can just try WebView.reload() just like :
if(first_loading){
w.loadUrl(DisplayActiviyParam.sd_html);
first_loading = false;
}else{
w.reload();
}
,what you need do is tu change your css file contents. Good lucky!

Categories

Resources