You could use
http://developer.android.com/reference/android/view/View.html#setBackgroundResource(int)

On Mon, Apr 4, 2011 at 4:01 PM, Aditya <[email protected]> wrote:

> Thanks for the response, But am looking something to be done in code
> itself, not in xml.
>
>
> On Mon, Apr 4, 2011 at 3:27 PM, Raghav Sood <[email protected]> wrote:
>
>> Hi,
>>
>> 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 <[email protected]> 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?
>>>
>>> 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 [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> 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/
>> http://www.telstop.tel/
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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/
http://www.telstop.tel/

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

Reply via email to