Issue
I have the following HTML in the 'assets' folder:
<html>
<head>
<style>
a#button
{
cursor: pointer;
background-size: 100% 100%;
background-color: transparent;
background-image: url('button.png');
}
a#button:active
{
cursor: pointer;
border: 2px solid white;
}
</style>
</head>
<body style="background-color: black; margin: 0px; border: 0px; padding: 0px;">
<img id="bkg" src="background.png" style="position: absolute; top: 0px;" />
<a id="button" href="someurl" style="position: absolute;"></a>
</body>
</html>
As you see, just two images and nothing else. The second image is a hyperlink, that references a server and looks like a button with the text: "Retry to connect". I show the page when there is an error:
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
view.loadUrl("file:///android_asset/html/nointernet.htm");
}
Imagine, how shocked I was when I saw that I could select a text on the page with the text selectors! I had copied the text into clipboard then pasted in a text editor and it was:
Check to make sure your device has a signal and data connection Reload this web page later. View a ca
Where the text did appeared from?!
Regards,
Solution
This is well-known and very old (3 years) Android issue, http://code.google.com/p/android/issues/detail?id=2340, that is still not resolved.
UPDATE
BTW, my unintended workaround seems to be the best of all I've read there. WebView background color should be set to zero (black), that eliminates flashing. Also, it's sensible to set hyperlink color to zero (black) too, if possible via WebView properties, and instead of showing error page on 'retry' button click, you will see black screen only.
Though I still have no idea how the text is getting fixed while tapped that's resulted as a strange mix of my page and the standard error page...
UPDATE 2
Alas, there is no properties for hyperlink colors (normal/visited), but maybe setTextZoom() and default font setting can do something to hide the URL (which renders in a different color) completely.
Answered By - noober
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.