/ ** Set the animation shift rightward shift 150 * / final TranslateAnimation animation = new TranslateAnimation (0, 150, 0, 0); animation.setDuration (2000) ;/ / set the duration of the animation animation.setRepeatCount (2) ;/ / set the number of repetitions animation.setRepeatMode (Animation.REVERSE) ;/ / set in the opposite direction to perform
start.setOnClickListener (new OnClickListener () { public void onClick (View arg0) { / ** Start the animation * / image.setAnimation (animation); animation.startNow (); } });
cancel.setOnClickListener (new OnClickListener () { public void onClick (View v) { / ** End of the animation * / animation.cancel (); } }); }
android: id = "@ + id / main_start" android: layout_width = "60dp" android: layout_height = "40dp" android: layout_below = "@ id / main_img" android: text = "start" />
android: id = "@ + id / main_cancel" android: layout_width = "60dp" android: layout_height = "40dp" android: layout_below = "@ id / main_start" android: text = "Stop" />
Click on the button when I want to put a simple animation, but clicking did not respond, if I move out of the movie, not on the onclick event of the button which is normal, I do not know why the<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) -> Reply: The setAnimation replaced startAnimation Reply:
Well, you can, but why, animate animation can not open it? Why, then, can be used on the outside onclick set, and put inside it must start onclick Reply:
Start is enabled threads, each activty is loaded asynchronously, with the Strat is loaded and activity together, and you have to click after the start, that is set up,,, Reply:
The setAnimation replaced startAnimation
Well, you can, but why, animate animation can not open it? Why, then, can be used on the outside onclick set, and put it inside onclick must start
Start is enabled threads, each activty is loaded asynchronously, with the Strat is loaded and activity together, and you have to click after the start, that is set up,,,
You are not backwards Reply: activity is the main thread is automatically turned on, the child thread needs to start
No comments:
Post a Comment