だから私の質問は、アニメーションを作成するにはどうすればよいですか?
main.java :
public class Main extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ImageView is = (ImageView) findViewById(R.id.img1);
is.setBackgroundResource(R.animator.animup);
final AnimationDrawable animup = (AnimationDrawable) is.getBackground();
final ImageView iv = (ImageView) findViewById(R.id.img1);
iv.setBackgroundResource(R.animator.anim);
final AnimationDrawable anim = (AnimationDrawable) iv.getBackground();
is.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN) {
anim.setVisible(true, true);
anim.start();
//perform your animation when button is touched and held
} else if (event.getAction() == MotionEvent.ACTION_UP) {
anim.setVisible(true, true);
animup.start();
//perform your animation when button is released
}
return false;
}
});
};
;
}
+別の問題...... 編集済み