Simple app using animation
This app demonstrates picture display and output, click on picture:
app/res/drawable - pictures
There is one images moved into here, called star.gif, a red star. The other is called empty.png and is an empty star.
app/res/values/strings.xml - strings
Flood
Picture for animation
Rotate
Stretch X
Stretch Y
app/res/layout/activity_main.xml - screen format
app/java/com.(the project name)/MainActivity - main code for app
package com.edkins.flood;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void doRotate(View view) {
ImageView starImage = (ImageView) findViewById(R.id.starPic);
Animation anim = AnimationUtils.loadAnimation(this, R.anim.rotate);
starImage.startAnimation(anim);
}
public void stretchX(View view) {
ImageView starImage = (ImageView) findViewById(R.id.starPic);
Animation anim = AnimationUtils.loadAnimation(this, R.anim.stretchx);
starImage.startAnimation(anim);
}
public void stretchY(View view) {
ImageView starImage = (ImageView) findViewById(R.id.starPic);
Animation anim = AnimationUtils.loadAnimation(this, R.anim.stretchy);
starImage.startAnimation(anim);
}
}
app/res/values/rotate.xml - animation for rotating image
app/res/values/stretchx.xml - animation for stretch X axis
app/res/values/stretchy.xml - animation for stretch Y axis
Index to my other websites
© Jo Edkins 2016