Forum Cross Platform with Xamarin


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Create animation in the button

Hiton4ikHiton4ik UAMember
edited October 2012 in Cross Platform with Xamarin

I want to create animation on the button. Button has its image. When clicking on the button should work animated image. Once the animation is complete - show previous image.

Something like the following algorithm:

Closed shutter > Click > PLAY ANIMATED SHUTTER > Show image

How can this be organized? thank you


  • Hiton4ikHiton4ik UAMember

    I did not elaborate. I already have ready animation "Animation.gif". It needs to be run when you click on the button.

  • CheesebaronCheesebaron DKInsider, University mod

    On Android it is easiest to show a gif in a WebView. However I am not sure how to do it on the other platforms...

  • Hiton4ikHiton4ik UAMember

    I did the following:

    Create file AnimationClick.xml:

    <?xml version="1.0" encoding="utf-8"?>
      <item android:drawable="@drawable/ButtonState1" android:duration="250"/>
      <item android:drawable="@drawable/ButtonState2" android:duration="250"/>
      <item android:drawable="@drawable/ButtonState3" android:duration="250"/>
      <item android:drawable="@drawable/ButtonState4" android:duration="250"/>

    Andr create file ItemImage.axml:


    To run this animation should do the following:

    ImageView image = (ImageView)FindViewById(Resource.Id.imageAnimation);
     animation = (AnimationDrawable)image.Drawable;

    imageAnimation - My ImageView.

    But I use a GridView in which 20 ItemImage.

    How to start an animation when pressed on one of the ImageView?

  • StuartLodgeStuartLodge USBeta ✭✭✭

    Just answered on StackOverflow

    Basic answer is try creating a custom control - see:

Sign In or Register to comment.