c# - How can I use animation in xamarin android application? -


i want use animation in android application using xamarin c#. animations fade-in, zoom-in, move , ....

first add folder under "resources " folder name "anim". can add animation resources , ex: fade-in animation create resource under anim folder , name "fade_in.xml" , paste code it:

<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"     android:fillafter="true" >      <alpha         android:duration="1000"         android:fromalpha="0.0"         android:interpolator="@android:anim/accelerate_interpolator"         android:toalpha="1.0" />  </set> 

then add textview in mainlayout.xml , button

 <textview             android:text="text"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:id="@+id/txtmessage"             android:layout_marginbottom="35.3dp" /> 

and button:

<button                 android:text="fade in"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content"                 android:id="@+id/fadein" /> 

in "oncreate" method in activity add code :

  button fadein = findviewbyid<button>(resource.id.fadein);             fadein.click += btn_click; 

then add method activity:

void blink_click(object sender, eventargs e)         {             txtmessage = findviewbyid<textview>(resource.id.txtmessage);              button b = sender button;             animation anim = animationutils.loadanimation(applicationcontext,                            resource.animation.fade_in);              txtmessage.startanimation(anim);         } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -