Inconsistency in setting html text to Android TextViews and WebViews - android

I am using Html.fromHtml to setText to my textView. Here is my text.
The figure below is not drawn to scale. Which of the following will most likely to be the value of ∠P?
In this sentence, angle sign is html value ( ).
It is working fine in emulator. I also tested on some android device (some unnamed tablets an ebook readers). They are ok. But in my android phone (Sony Xperia X8), it is not rendering angle sign. Instead, it is showing .
Is there anything wrong? Why is it not being consistent across devices although it is just a textview rendering simple html? More importantly, how could I solve this issue. Following is my graphical representation of my problem.
Edit: It is not only in textviews but also in webviews. I changed using webview instead of textview. Unfortunately, it didn't work out as well. Anyone got any idea?

Related

website Images distorted/disappear on Android browers

I have created a fairly simple responsive website and have optimized it for mobile use using the meta tags. It works very well on desktops and on iOS phones and even the Galaxy S5. However, based on some tests using a browser compatibility program, the design falls apart on Android devices using 4.2 or lower (including the Samsung Galaxy S2 through 4, Kindle Fire 2, and Google Nexus). The images (doesn't seem to matter what type of file) will either become very vertically stretched or disappear altogether, no matter the file type. I have tried many things and can find no apparent difference between the images that are displaying and those that are not. Also, my header and footer are no longer where they are supposed to be. From what I can tell, the problem is that Android is not interpreting my css in the same way as ios does.
I have been able to fix the problem somewhat by dictating pixel dimensions for all of the photos instead of percentages, although this messes with the responsiveness of the site. This also fixes my header/footer problem although there is a very large space on the top and bottom of the mobile drop down menu and my logo in the footer (.svg) is distorted despite giving it dimensions.
I can't seem to find any information about this problem so I feel like it has to be an easy fix that I am overlooking.
The website is www.2015housingconf.com.
Thanks in advance!

autoLink="all" feature of TextView Android

I am using the autoLink="All" feature of TextView to linkify all urls and telephone numbers in a TextView.
The problem I am facing is that on emulator, certain numbers are identified as phone numbers and are clickable.
On real device, these numbers doesnt get identified as phone numbers and are not clickable.
Say If the TextView contains a number 163111, On emulator it is clickable. Clickng this takes user to dialer.
But on Nexus 7 this number is not clickable.
I had a look at the Linkify.addLinks() method, which I thought would explain this behaviour, but failed to find an explanation.
Has any one faced this problem?
What may be the reason behind this?
try "autolink" property for textview.
android:autoLink="email|phone|web"
Never mind. The emulator was running on 4.2 and Nex 7 was on 4.3
https://android.googlesource.com/platform/frameworks/base/+/430fc97
The modifications in Linkify code was the reason.

Dipaly farsi text in android webview (for phones not supporting farsi)

In farsi letters are attach together to form writing scripts. However when I save HTML pages using "UTF-8" or "Windows-1256" encdoings, and try to display them using webview in android, letters are diplayed seperately and in left-to-right direction (instead of RTL).
I should notice that this case is not happening in phones supporting farsi.
Correct form should be like this (snapshot from phone supporting farsi):
Bad-formed text happens in phones not supporing farsi (Persian):
It should be noticed i've used persian font in both cases.
I also see some solutions for normal Strings in java which changes character on by one in this
question
My question: Can i fix this cases (or it should be fix by phone vendors)? if possible what is solution?
I hit this bug a lot when I was doing keyboards. The problem is that the build in canvas.drawText function in Android didn't support RTL languages. There was a patch for it, but it wasn't part of the default build of Android. So only models going out to those parts of the world that used it tended to have it. Unfortunately I know of no way to test whether it has the patch. And if it doesn't, there's no way to fix it. You could try reversing the text, but then you'd break devices which did have the patch.
Long story short- there is no way to fix it. However, I'd be shocked if Google hasn't picked up the patch in mainline by now (it existed back in the 2.2 days), so its a shrinking number of phones effected.
You can try making html with reverse font sequence! just write a windows app to get font and deliver reverse one, and use it in your android device

JQuery touchpunch draggable laggy on android device

I have used the draggable jquery of touchpunch: http://touchpunch.furf.com/ in my phonegap application for my android phone. I uploaded pictures of objects to drag over a picture. But whatever object I try to drag it always seems laggy, while on my iphone it works perfectly fine without lag. This has been tested on a Desire HD and Samsung Galaxy S2 so not the slowest types of android phones. Does anyone have an idea what is causing it and how to fix it? Thanks!
Have you set position : absolute for the element? This can increase performance greatly because anything with position : relative being animated/moved requires a redraw of the whole page (since ancestors and descendants can be affected by any changes). Using position : absolute only requires a redraw of the region that the element takes-up (so anything in-front or behind the element and the element itself).
I tested the demo page on my Droid X (almost two years old now) and it functioned fine, but it is a simple test.

Why is this android device enlarging text?

The website is tavistockrestaurants.com. We are trying to make this design work well in popular mobile devices. A particular android device seems to be enlarging the text, and I am unsure why. This causes the "contact" link in the top to wrap, and causes unecessary line breaks throughout our website. Notice the form is getting pushed below the images in this screenshot? It's supposed to have white space on the bottom!
We do have -webkit-text-size-adjust: none in place for all elements (using asterisk *). Is there an android equivelant? Has anyone experienced this on any android devices?
This behavior does not occur on all android devices. We have only seen this on Android 4.x, but I cannot reproduce it with my android 4.0 emulator.
What it currently looks like:
What it should look like:
(I do not have the specific device model used in the screen cap)
In CSS, pixels are not pixels.
Or rather, 1 CSS pixel does not always map to 1 hardware pixel. On certain high-DPI Android devices, one CSS pixel can be 1.5 or 2 hardware pixels. The Opera guys have a good overview on the topic.
Samuels answer is correct.
There is a workaround though. You can target specific devices and change the styles for that device specifically using classes or stylesheets. If you are using PHP you should be able to parse the "User-Agent" and determine which device the client is using and add a class to the body tag (and use that class to target that specific device in your CSS).
There are also services that will allow you to send users to a different version of the site depending on the device they are using. Here is a site that does the work for you.
There may also be device specific CSS being generated on loading the page. Using a CSS reset may also help your site be more cross-browser compatible.

Categories

Resources