1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| public class SimpleAnimation extends Activity {
private AnimationListener listener;
public void startAnimation(int id_view) {
switch (id_view) {
case 0: {
ImageView anim_view = (ImageView) findViewById(R.id.image_view_asphalt_01);
Animation fader = AnimationUtils.loadAnimation(this, R.anim.fade);
anim_view.startAnimation(fader);
fader.setAnimationListener(listener);
if (fader.hasEnded()) {
fader.cancel();
}
break;
}
// case 1: {
// ImageView anim_view_02 = (ImageView) findViewById(R.id.image_view_asphalt_02);
// ImageView animation = (ImageView) findViewById(R.id.image_view_anim__inox);
// animation.setBackgroundResource(R.drawable.animation_inox);
// AnimationDrawable animate = (AnimationDrawable) animation
// .getBackground();
// animate.start();
// }
}
}
}
public class Fragment00 extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
SimpleAnimation animation = new SimpleAnimation();
animation.startAnimation(0);
if (container == null) {
return null;
}
return (LinearLayout) inflater.inflate(R.layout.lay_asphalt_01,
container, false);
}
} |
Partager