0

I did the following:

Create file AnimationClick.xml:

<?xml version="1.0" encoding="utf-8"?>
<animation-list
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:oneshot="true">
  <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"/>
</animation-list>

And create file ItemImage.axml:

<ImageView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:local="http://schemas.android.com/apk/res/LeSommet.ZooSnap.UI.Android"
      android:layout_width="80dp"
      android:layout_height="80dp"
      android:padding="5dp"
      android:layout_gravity="center"
      android:src="@drawable/AnimationClick"
  />

To run this animation should do the following:

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

imageAnimation - My ImageView.

But I use a GridView in which 20 ItemImage. How to start an animation when pressed on one of the ImageView?

Stuart
  • 66,722
  • 7
  • 114
  • 165
Andrew Andreev
  • 394
  • 4
  • 13

1 Answers1

0

To do this, I think the easiest way is to create a custom control and to trigger the animation within that control.

To see how to do this for a list, take a look at the answers for: How to create view's actions listener for MvxItemTemplate

Community
  • 1
  • 1
Stuart
  • 66,722
  • 7
  • 114
  • 165