How to make work the animation after clicking the Button?

There is a simple AnimationDrawable animation of two frames gradient_animation.xml:

<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true">
 <item android:drawable="@drawable/gradient_box" android:duration="200">
 <item android:drawable="@drawable/gradient_box_end" android:duration="200">
</item></item></animation-list>


gradient_box and gradient_box_end is shapes, which differ only in the length width (280 and 180dp):

<?xml version="1.0" encoding="UTF-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
 <size android:width="280dp" android:height="50dp">
 <gradient android:startcolor="#FF3366" android:endcolor="#FF3366" android:angle="180">
 <padding android:left="7dp" android:top="7dp" android:right="7dp" android:bottom="7dp">
 <corners android:radius="35dp">
</corners></padding></gradient></size></shape>


Accordingly, the switch is set to android:background="@drawable/gradient_animation"

In mainactivity.cs:

protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);

SetContentView(Resource.Layout.Main);

 Button buttonlogin = FindViewById
July 9th 19 at 12:47
1 answer
July 9th 19 at 12:49
with which this problem arose?onWindowFocusChanged
You can read more.
can't remember to be honest - a lot of options tried. With onWindowFocusChanged also seems to have triggered after subsequent interactions with the application. Tried to put in the Runnable, but it didn't work from Java to C# rewrite. - casandra.Kemmer commented on July 9th 19 at 12:52
offer again to try RunnableAnonymousInnerClassHelper with onWindowFocusChanged If you are not lazy) To nowhere now to try. - mercedes commented on July 9th 19 at 12:55

Find more questions by tags AndroidC#