Incorrect webview background for Android 4.0.4
Closed this issue · 31 comments
What steps will reproduce the problem?
1. use Android 4.0.4 (exact this version, see
https://code.google.com/p/android/issues/detail?id=28410)
2. open the changelog dialog
What is the expected output? What do you see instead?
The expected output is a webview with transparent background, but you see a
white background instead.
What version of the product are you using? On what operating system?
As stated above, Android 4.0.4. Screenshots:
http://img6.imageshack.us/img6/4111/changelogo.png
http://img805.imageshack.us/img805/6167/changelog2.png
Please provide any additional information below.
Solved by adding these code lines:
in the getDialog method:
if(Build.VERSION.SDK_INT == 15) {
setSoftwareLayerType(wv);
}
And add a function:
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setSoftwareLayerType(View view) {
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
I could test it on Android 4.0.4 (the code is executed in this version),
Android 4.2.1 (not executed here) and Android 2.3.3 (and not here).
Too bad, that there is no emulator for Android 4.0.4, only for 4.0.3.
Original issue reported on code.google.com by weingard...@gmail.com
on 20 Dec 2012 at 9:54
so this only happens with 4.0.4 and not above or below?
Original comment by koem...@gmail.com
on 23 Dec 2012 at 3:20
hello?
Original comment by koem...@gmail.com
on 12 Jan 2013 at 5:23
I confirm I have the same issue on the following configurations:
* HTC sensation, with ROM ViperS 1.5.0 -> android 4.0.3 and sense 4.1
* 32GB HP Touchpad with CM9
Works well on my SII with 4.0.3
Original comment by h.quest...@gmail.com
on 24 Jan 2013 at 10:26
could you both please check if view.setAlpha(1.0f) works, instead of
setLayerType. Problem is: these methods were introduced in API Level 11 (3.0).
I must check what to do, to support older API Levels, too. I can't just call a
Level11 method. this will break compatibility with Android < 3.0...
Original comment by koem...@gmail.com
on 25 Jan 2013 at 7:49
I can't test because I do not have such devices myself.
This issue has been reported by some of my users with screenshots as proofs.
Original comment by h.quest...@gmail.com
on 25 Jan 2013 at 8:45
Well, then they need to test it... make test version with another package name
in AndroidManifest, so the can install your app twice.
Original comment by koem...@gmail.com
on 25 Jan 2013 at 9:28
Just for the record... Some tests in the emulator, without any code changes
compiled for Android 1.5 APIs v3:
Android 4.0.3, normal APIs v15: ok
Android 4.0.3, Google APIs v15: ok
Android 4.1.2, normal APIs v16: ok
Android 4.1.2, Google APIs v16: ok
compiled for Android 1.5 APIs v3:
Android 4.0.3, Google APIs v15: ok
Android 4.1.2, Google APIs v16: ok
Original comment by koem...@gmail.com
on 26 Jan 2013 at 9:42
ok, resolved it by calling wv.setLayerType(View.LAYER_TYPE_SOFTWARE, null) when
API-Level >= 11
Setting this should not harm anyone so I do it for any API Level that supports
it.
Tested in Emulator on 1.5 and 4.2
Please test by using the sample App in the download section
Original comment by koem...@gmail.com
on 27 Jan 2013 at 7:38
- Changed state: Fixed
Hi, the current fix is just a workaround. It disables hardware acceleration,
and makes the scroll not smooth. What's more, it doesn't work in my Nexus 4 (JB
4.2.2).
What I did to make it work is
1) Set the theme for the AlertDialog builder to Theme_Dialog, using the
ContextThemeWrapper:
AlertDialog.Builder builder = new AlertDialog.Builder(new
ContextThemeWrapper(this.context, android.R.style.Theme_Dialog));
2) Set the background color to Black, instead of 0 (Transparent). Otherwise, I
got a couple of white flashes on the background, on the first scroll of the
changelog.
wv.setBackgroundColor(Color.BLACK);
Original comment by julianjm@gmail.com
on 6 Jun 2013 at 4:42
Hi Julian,
Thanks for the solution. I'm in holiday right now and my also laptop just went
to hell (maybe the heat here in Honduras?). So I can maybe care for this in mid
July...
Until then: bug open again
Koem
Original comment by koem...@gmail.com
on 8 Jun 2013 at 10:47
- Changed state: Started
Ok, implemented it. This is good. I could get rid of all the API dependent
code. Hopefully it works with all devices...
Thanks!
Tests:
real device
- cm10.1 = 4.2.2 - ok
emulator
- Android 1.5 - ok
- Google APIs 2.2 - ok
- Android 2.3.3 - ok
- Google APIs 3.2 - ok
- Google APIs 4.0.3 - ok
- Google APIs 4.1.2 - Android didn't boot - my machine is too slow
Original comment by koem...@gmail.com
on 19 Jun 2013 at 6:20
- Changed state: Done
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
Android 4.0.3, Google APIs v15: ok
Original comment by ISitompul20@gmail.com
on 6 Oct 2014 at 4:45
so leave it #25
Original comment by crz210...@gmail.com
on 15 Nov 2014 at 7:20
Thanks
Original comment by gghhhh98...@gmail.com
on 28 Nov 2014 at 12:17
Help me out on this
Original comment by Syaravan...@gmail.com
on 17 Dec 2014 at 5:15
[deleted comment]
Thanks for the help
Original comment by cisnerosakayolo
on 15 Jan 2015 at 4:37
.........
Original comment by elliottc...@gmail.com
on 12 Feb 2015 at 11:03