Text reflow in Android Webview - android

Text reflow has been removed from Webviews since the Android KitKat release. Unfortunately, Lollipop does not fix the problem. It seems that, for some unknown reason, Google has decided that text reflow is not needed:
https://code.google.com/p/android/issues/detail?id=62378
I am using Webviews to show HTML code produced by my application. So I have full control over both the HTML content and the Android application. Do you know of a way to implement text reflow after pinch-zoom by the user? Perhaps it can be done by modifying the HTML or using Javascript and/or CSS? After searching the web for a few days and trying some of the proposed solutions, nothing seems to work correctly.
Alternatively, is there a different control which supports both pinch-zoom and some basic text formatting (color, bold, size, etc)?
Finally, does anyone know why Google removed pinch-zoom text reflow? It worked perfectly on Android 2.2.

Related

StageText and Emoji on Android - AIR Mobile - AS3

I have a big problem and can't find anything about it online.
Using Flex/Air Mobile I do a simple thing, using 2 components:
txt2.text = txt1.text;
If txt1.text contains emoji, they are not taken to txt2. Instead, it creates a mess with weird characters.
What kills me is that when you type it, the emoji are shown correctly. When I capture the value and trace it, the emoji appear on Flash Builder's console (in OSX) correctly, but when you set the value of another StageText (I tried it with raw StageText, created from code to avoid any other class or code from interfering)
Right now I met a dead end, no ideas of what else to do...and I have to release to Android a chatting app that's working like a charm on iOS, and I have this problem.
Ideas? Please?
try this:
txt2.text = decodeURI(txt1.text);
but I am afraid this is because StageText use a native input textfield that on iOS is able to reach the Apple Color Emoji font that is not available on Android

Devanagari/Marathi font

I am developing an Android app for regional magazine which is in Marathi language and from OS 2.2 and above. I am able to use custom fonts for the devices which does not support Devanagari/Marathi natively using typeface.
But the result is not desired and the Marathi text does not look any better. I have following problems with the custom fonts.
Extra horizontal space between two words or character
Extra vertical space between two line
Collapse of two lines
Does not works on all devices
Joint characters(जोडाक्षर e.g.'त्या') are not showing well
I have tried many fonts like utsaah,mangal,arialuni,shivaji but none of them have full support.
I have seen one of very good marathi app here which works on Android 2.1 and above. Can anyone please help me? How can I use a font which supports all Android devices?
I don't know if it is possible to fix the problems you listed in your question using custom fonts.
But let me suggest you an approach to display your content using WebView. In a WebView marathi should look fine. You can use custom fonts as well. The only difference is that instead of composing xml layouts you will have to create web pages (html+js) and package them in your app.
A couple of how-to-start guides:
developer.android.com
developer.chrome.com
An alternative to this solution would be using a framework. The app you referenced to (Sakal) uses Appcelerator Titanium.

Android text input in a webview shows a second box

I'm developing an application for Android (and iOS) using PhoneGap, and have come across a problem where as a result of some -webkit-transform: translate3d(x,y,z); calls, my text input boxes that are created by Android are no longer lined up with the element on the page.
The issue that I'm experiencing is the same as this one, however I wish to hide the boxes that Android creates and instead use the ones that are present within my application's DOM. Is this possible?
There is a specific article about Android form bugs in our documentation, check it out. Unfortunately there is no full solution for this problem, but at least the newer Kendo UI Mobile versions implement a partial workaround for this issue (which btw was finally fixed in Jelly Bean). Since the workaround has several negative effects, consider if you want to use it at all.

Indic languages on Android browser/GUI (Gujarati) improper rendering

I have a website specifically for viewing on Android devices, I am using Gujarati languages and i have a big problem rendering the Gujarati Fonts properly, I atleast want a workaround to get the Gujarati fonts Working properly which is by default not supported on any Android versions. And so i did,
The Work around:
- Rooting the phone
- Finding the correct unicode font for Gujarati language
- Replace the existing DroidSansFallback.ttf in System/fonts with the Gujarati Font (with some extra changes in fontsfallback.xml in system/etc folder for ICS)
This Helped me to atlest view Gujarati texts, but not correct rendering.
The Problem:
1) Problem of Half forms, the half form letters are not rendering properly as they are suppose to combine but they dont,
If you refer to this faq on unicode.org, it clearly defines how it should render,I have also used the mentioned "Zero Width Joiner" by using html codes for every letter using [unicodeLookup][7] but it has no effect.
Anyways This problem is not primary as it is improper but still not incorrect.
2) This rendering problem makes the texts print incorrectly, See the two images below, First one is correctly render as visible on PC and second on is a screenshot from Android native browser
image
the problem marked as 1 are fist problem and the one marked as 2 are second problem, if you google "Devanagari - Unicode Consortium ch09" you will get a pdf refering to this problem (just goto "Figure 9-8. Rendering Order in Devanagari") which clearly explains the method to render the scripts correctly. It seems what ever android uses to render the scripts is not supported for such languages, if there is any change that can be made to Android OS to render the fonts in correct order, please help.
This is definitely not a problem with fonts as i have tried using Shruti fonts which is used by windows OS, it is a problem with rendering these complex scripts
Possible Solutions: (unwanted)
1) Using opera mini with bitmap fonts (not my solution)
2) Use Images instead of texts (again not my solution as my site will have 300 lines of lists and that too for mobile, do not want to increase page size)
Please give me a proper solution to this problem, thanks in advance !!
Rendering Gujarati (and other "complex" scripts, i.e. those which use half-forms, contextual forms, rearrangement, etc.) requires more than just fonts; it also needs text layout. Text layout capability is normally supplied by the host operating system or in some cases the application. Android has been improving text layout support, but even the latest version is still not complete for all scripts. In other words: you cannot easily fix this with fonts alone, even for recent versions of Android.
Possible workarounds:
develop some kind of plugin or extension that does correct Gujarati layout and require users to download/install the plugin to use your site. This will likely be a very high-impedance path, requiring a great deal of expertise in fonts, software development, and knowledge of the target writing system. Not to mention the inconvenience for your users.
develop a custom version of a Gujarati font and use corresponding custom text in your site that does not require text layout; supply the font via #font-face (webfont). This will also likely be fairly challenging if you do not have experience with font development, but would probably be the best path.
render the text to images; do browser-sniffing and supply images for cases where the client is known not to support complex scripts. This is likely to fail much of the time (hard to keep track of browser capabilities, not to mention the problem of reliably detecting browsers to begin with). But guaranteed to give the right results.
If you want to view your website in all devices just put webfonts in the your website. web fonts are embedded fonts that you put on your server and with proper css link everybody can view that without installing the fonts on devices.
For other websites not having web fonts use firefox for android and then get addon https://addons.mozilla.org/en-us/android/addon/gujarati-fonts-package. Now you can view all webpages in Gujarati fonts without any complex procedure or root the android.

Any disadvantages to using WebView as opposed to TextView in Android

I am making an app a bit like a dictionary, where a user clicks on a word and get a display of an image and an explanation of that word. I know that WebView allows me to use html formatting but I have read that it takes a lot of memory. Is there any disadvantage to using a WebView in this way or should I use a TextView?
WebView works well on my phone, an HTC Wildfire.
TextView works fine if you only want to display text -- or only very simple formating.
If you want to display something more advanced, WebView will definitely allow you to do more, as it allows one to use Full-HTML.
Of course, this requires more power... but, still, if you are only using one WebView at a time on your screen/activity, it cannot be worse than when using the browser application -- and that one works fine, doesn't it ?

Categories

Resources