Monday, April 4, 2011

[android-developers] Tansition between two Images.

Hello,
I need to keep an image in background and rotate or do any other animation on top of that with another image.
But I cant keep any image in background.
 
Can any one please help me?
 
Thanks
Aditya.
 
 
----------------------------------------------------------------------------------------------------------------------------------------------
private void createAnim(Canvas canvas) {
  setBackgroundDrawable(getResources().getDrawable(R.drawable.ars));
  System.out.println("11111111111111111111111111111111");
  anim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
         Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f
        
);
 
  anim1 = new RotateAnimation(0, 360, canvas.getWidth() / 2, canvas
    .getHeight() / 2);
  anim.setRepeatMode(Animation.ZORDER_BOTTOM);
  anim.setDuration(10000L);
  anim1.setDuration(10000L);
  startAnimation(anim1);
  
 }
 protected void onDraw(Canvas canvas) {
  int centerX = canvas.getWidth() / 2;
  int centerY = canvas.getHeight() / 2;
  setBackgroundDrawable(getResources().getDrawable(R.drawable.ars));
  canvas.drawBitmap(jobs1, centerX - jobsXOffset1,centerY - jobsYOffset1, null);
  Paint paint = new Paint();
        paint.setColor(Color.WHITE);
        if (anim == null) {
   createAnim(canvas);
  }      
}
----------------------------------------------------------------------------------------------------------------------------------------------

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment