Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the Android Webview support CSS3 WebKit Animations?

Does The WebView Control on Android OS support hardware accelerated css3 animations? And all the webkit css (for example: -webkit-transition bla bla) that I have that work on Safari Mobile do they work the same on android?

like image 976
Shai UI Avatar asked Nov 25 '11 02:11

Shai UI


2 Answers

Yes, according to this page.. It supports starting from version 3.0 til last, beloved Jelly Bean ;)

On the other side developers experienced not super successful results. Quote from here:

CSS animations are supported by Android devices — but only if a single property is changed. As soon as you try to animate more than one property at once, the entire element disappears. In non-native Android browsers, the element will be visible for the duration of the animation, but will hide immediately after it’s finished.

and update from the same source:

..it turns out Android 4.0 actually addresses this issue. Still, we need to urge the authors of these resources to explicitly mention that full support isn’t available in previous versions of Android..

So final answer 4.0+ version support it in a good way..

UPDATE: From KitKat WebView is powered by Chromium (same engine as in Chrome browser) so from this Android version advanced HTML5 and CSS features should be fully supported.. More about this here

Hope u find it useful.. ;)

like image 109
Ewoks Avatar answered Sep 25 '22 02:09

Ewoks


If you want webkit transitions to be animated hardware accelerated in an Android Webview you'll need to enable hardware acceleration in the manifest file like so:

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

    ...

    <application ... android:hardwareAccelerated="true">
        ...
    </application>

</manifest>

It's not perfect, but it improves the rendering a lot.

like image 25
Dodi Raditya Avatar answered Sep 26 '22 02:09

Dodi Raditya