Created
May 29, 2014 13:07
-
-
Save greengoblinmask/afc9a23d8e2e6d90c894 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.animation; | |
import com.example.animation.R; | |
import android.os.Bundle; | |
import android.app.Activity; | |
import android.view.Menu; | |
import android.view.MenuItem; | |
import android.view.animation.Animation; | |
import android.view.animation.AnimationUtils; | |
import android.widget.ImageView; | |
public class MainActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
} | |
@Override | |
public boolean onCreateOptionsMenu(Menu menu) { | |
// Inflate the menu; this adds items to the action bar if it is present. | |
getMenuInflater().inflate(R.menu.main, menu); | |
return true; | |
} | |
public boolean onOptionsItemSelected(MenuItem item) | |
{ | |
super.onOptionsItemSelected(item); | |
switch(item.getItemId()) | |
{ | |
case R.id.zoomInOut: | |
ImageView image = (ImageView)findViewById(R.id.imageView1); | |
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.myanimation); | |
image.startAnimation(animation); | |
return true; | |
case R.id.rotate360: | |
ImageView image1 = (ImageView)findViewById(R.id.imageView1); | |
Animation animation1 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.clockwise); | |
image1.startAnimation(animation1); | |
return true; | |
case R.id.fadeInOut: | |
ImageView image2 = (ImageView)findViewById(R.id.imageView1); | |
Animation animation2 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade); | |
image2.startAnimation(animation2); | |
return true; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment