androidandroid-custom-viewandroid-progressbarlibrary-project

Animations in Android Libraries don't animate?


I have an app which uses a single common library used throughout my applications in order to keep a common theme.

In this library, I have the following style defined:

<style name="App.Widget.ProgressBar.Large"  parent="@android:style/Widget.ProgressBar.Large">
    <item name="android:indeterminateDrawable">@anim/anim_progressbar_large</item>
    <item name="android:minWidth">80dip</item>
    <item name="android:maxWidth">80dip</item>
    <item name="android:minHeight">80dip</item>
    <item name="android:maxHeight">80dip</item>
</style>

Which should allow a custom progress spinner to be displayed (irrelevant of device).

When this resource is local to the app (app/res/values/), not in the library, my Spinner animates correctly. However, when this style resource is in the library (library/res/values), the Spinner displays the beginning image but doesn't animate.

Does anyone know why the location of the resource would make a difference? I don't want to have to duplicate this resource for each application.


Solution

  • This is an old question, and I'm not sure I had exactly the same problem as the individual that posted the question, but for some reason using

    style="@android:style/Widget.ProgressBar.Large"
    

    did not animate the ProgressBar for me, whereas using

    style="?android:attr/progressBarStyleLarge"
    

    did. Hope it helps someone.