13

In my project there are two WebViews and I am switching these WebViews alternatively to get a smooth animation while loading my url. When I am using Webview.loadUrl() method, it works fine in all devices. But when I am using the same code with loadDataWithBaseUrl() then its not working in 4.0.3 but it's working fine in 2.2, 2.3, 4.0.4, 4.1 devices.

Is this a bug jumping from WebKit? I tried so many ways to get this done but no way out. I am really frustrated and messed-up with this.

It will be so helpful if someone could show me a right way to get this done.

Wooble
  • 87,717
  • 12
  • 108
  • 131
Jackson Chengalai
  • 3,907
  • 1
  • 24
  • 39
  • Could you be more specific about it not working. Does it just not load anything period? Does it throw some kind of error? Etc. Also some code snippets would help. – Ifrit Jan 31 '13 at 15:33
  • 1
    I am loading this webview in an Assynctask.From doinbackgroungd i am calling runonuithread and load the webview using loaddatawithbaseurl()..when i use loadurl() its working fine in 4.0.3 but loaddatawithbaseurl() its failing.. – Jackson Chengalai Feb 01 '13 at 06:03
  • Whats the base url you have specified in the loadDataWithBaseUrl method ? – Kiran Kumar Feb 15 '13 at 06:03

2 Answers2

1

You can try to add these property with webview-

mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

and can use animation because its working well for me like-

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
  <translate 

      android:interpolator="@android:anim/cycle_interpolator"
      android:fromXDelta="100%p" android:toXDelta="0" android:duration="1000"/>
</set>
Dinesh
  • 83
  • 7
0

There appears to be a bug with 4.0.3 altogether with WebView animations. What fixed it for me was removing alpha from animation. Basic translate animation is behaving correctly.