ad728

Friday, December 29, 2017

AIDE Tutorial - 46 Blink Animation

AIDE Tutorial - 46 Blink Animation
Java
package com.kcgroup.animblink;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import android.view.animation.*;
public class MainActivity extends Activity
{   @Override
    protected void onCreate(Bundle savedInstanceState)
    {super.onCreate(savedInstanceState);
        setContentView(R.layout.main);    }
public void blink(View v){
ImageView image=(ImageView)findViewById(R.id.mainImageView);
Animation an=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
image.startAnimation(an);}}
Main xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <ImageView
android:layout_weight="4"
        android:src="@drawable/ic_launcher"
android:id="@+id/mainImageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
<Button
android:text="Blink"
android:onClick="blink"
android:layout_width="wrap_content"        android:layout_height="wrap_content" />
</LinearLayout>
Blink.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android"
>
<alpha android:fromAlpha="0"
android:toAlpha="1"
android:duration="1000"
android:repeatMode="reverse"
android:repeatCount="2"/>
</set>
Other Related Articles:
  1. AIDE Tutorial - 41 Animation Fade In & Fade Out
  2. AIDE Tutorial - 42 Animation Zoom In & Zoom Out
  3. AIDE Tutorial - 43 Animation Bounce Top Bottom Left Right
  4. AIDE Tutorial - 44 Rotate Animation
  5. AIDE Tutorial - 45 Slide Animation
  6. AIDE Tutorial - 46 Blink Animation
Share:

0 comments:

Post a Comment

Total Pageviews

Sponsor

Sponsor

ad300

Blog Archive