If the background image is literally a background you could set it in XML using android:background="@dfrawable/whatever". If it is for a small portion of the screen you could put it in an image view and draw the animation on top of it.
On Mon, Apr 4, 2011 at 3:21 PM, Aditya <dabhagavan@gmail.com> wrote:
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?ThanksAditya.----------------------------------------------------------------------------------------------------------------------------------------------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
--
Raghav Sood
http://www.raghavsood.com/
http://www.androidappcheck.com/
--
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