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.
We spent some time trying to figure out why some html content would not load in our app’s WebView. We found trivial html can be loaded into a WebView using the loadData (String, String, String) method. Rendering complex pages with Javascript is a problem.
To use WebView.loadData () with non latin1 encodings you have to encode html content. Previous example was not correctly working in Android 4+, so I have modified it to look as follows:
As I understand it, loadData () simply generates a data: URL with the data provide it. If the value of the encoding parameter is 'base64', then the data must be encoded as base64.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With