Wednesday, August 29, 2012

Re: [android-developers] ICS: White screen while changing visibility on Webview

Thanks once again! I didn't think of using values like that!

Marina

On Wed, Aug 29, 2012 at 11:48 AM, Kostya Vasilyev <kmansoft@gmail.com> wrote:
> Yeah, it's too bad, but I guess every bit of code needs time to mature (and
> GPU acceleration first appeared in 3.0, IIRC).
>
> What I do in my project is use a @bool reference like this:
>
> <application
> android:description="@string/app_description"
> android:hardwareAccelerated="@bool/hardware_accelerated"
> android:icon="@drawable/app_icon_my_own_light" .....
>
> Then in res/values-v5/values_ui.xml I have:
>
> <?xml version="1.0" encoding="utf-8"?>
> <resources>
> <bool name="hardware_accelerated">false</bool>
> </resources>
>
> and in res/values-v16/values_ui.xml:
>
> <?xml version="1.0" encoding="utf-8"?>
> <resources>
> <bool name="hardware_accelerated">true</bool>
> </resources>
>
> I suppose switching just the webview might be more "elegant", but I was
> seeing the white flash affect views outside of the WebView's boundaries.
> This is a real issue when you have a fragment-based multi-panel UI, so I've
> decided to switch the whole thing off for platform versions prior to 4.1.
>
> -- K
>
> 2012/8/29 Marina Cuello <marina.eariel@gmail.com>
>>
>> Thanks a lot! Adding the <activity android:hardwareAccelerated="false"
>> /> worked like a charm. I knew the solution was going to be simple. I
>> was just looking into the wrong direction :)
>> I'll see if I can fix it by code to let the hardware acceleration on
>> with Jelly Bean, but at least it works now.
>>
>> Marina
>>
>> On Tue, Aug 28, 2012 at 7:00 PM, Kostya Vasilyev <kmansoft@gmail.com>
>> wrote:
>> > I see WebView flash white on 3.0 - 4.0 (inclusive) if GPU acceleration
>> > is
>> > on.
>> >
>> > This happens even if the WebView's Android background as well as <body>
>> > background are set to black.
>> >
>> > Disabling GPU acceleration in the manifest fixed the issue for me.
>> >
>> > This appears to be fixed in the official 4.1.1 (Galaxy Nexus), where GPU
>> > accel can be kept on, and the white flash does not happen.
>> >
>> > -- K
>> >
>> > 2012/8/29 Marina Cuello <marina.eariel@gmail.com>
>> >>
>> >> Hi to all!
>> >> I have a little app with a layout that it's something like this:
>> >>
>> >> <FrameLayout>
>> >> <FrameLayout>
>> >> <ImageView/>
>> >> <ProgressBar/>
>> >> </FrameLayout>
>> >> <LinearLayout>
>> >> <WebView/>
>> >> </LinearLayout>
>> >> </FrameLayout>
>> >>
>> >> I initially set the ImageView (kind of a place-holder) and the
>> >> ProgressBar visibility to VISIBLE and the WebView's one to INVISIBLE.
>> >> Then I call loadUrl on the WebView. When the page finishes loading (I
>> >> use both onPageFinished and the detection of certain redirect on
>> >> shouldOverrideUrlLoading on a custom WebViewClient) I finally set the
>> >> visibility on the WebView to VISIBLE.
>> >>
>> >> Well, it works well on Android devices previous to Ice Cream Sandwich,
>> >> but it seems like the WebView "flashes" to white before showing.
>> >>
>> >> I searched around for ideas and tried several combinations like
>> >> letting the WebView as VISIBLE too and just hiding the place-holders,
>> >> hiding them with GONE instead of INVISIBLE, replacing the image with a
>> >> transparent one, and perhaps some others I already forgot.
>> >>
>> >> I'm testing with a Motorola Xoom recently (officially) updated to ICS;
>> >> a couple weeks ago it had Honeycomb and the app worked just fine.
>> >>
>> >> Anyone had any similar problem or could think of any other way I can
>> >> try?
>> >>
>> >> Thanks!
>> >>
>> >> Marina
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups "Android Developers" group.
>> >> To post to this group, send email to
>> >> android-developers@googlegroups.com
>> >> To unsubscribe from this group, send email to
>> >> android-developers+unsubscribe@googlegroups.com
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/android-developers?hl=en
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Android Developers" group.
>> > To post to this group, send email to android-developers@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > android-developers+unsubscribe@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/android-developers?hl=en
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscribe@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment