Question

I have an Activity with a quite complex layout, including a gallery of icons and I want to apply a scaling effect (repeating infinitely) on one of the icons.

The effect works perfectly in a sample activity which contains only the gallery. However in my original activity, the animation doesn't work. I noticed that the animated icon's scale gets updated every time I touch the gallery, but immediately stops. (which means I can somehow see the animation if I repeatedly touch the gallery very fast)

Do you have any idea of what could cause this issue or how to debug it ?

Thanks.

Was it helpful?

Solution

Solved by notifying the parent at each animation step :

ScaleAnimation animation = new ScaleAnimation(1f, scale, 1f, scale) {
    @Override
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        super.applyTransformation(interpolatedTime, t);
        View parent = (View)getParent();
        ChannelLogoView.this.postInvalidate();
        parent.postInvalidate();
    }
};
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top