Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Texture to Paint object in Android?

Tags:

android

view

I am using the code at http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/comment-page-1/#comment-14326 for building custom view.

I wanted to display the image in place of drawing the hand through code. I have tried setting the texture for the hand but have not got any success.

Can anyone let me know how can I set the image in place of hand?

like image 961
sunil Avatar asked Sep 03 '25 05:09

sunil


1 Answers

You can do it with a BitmapShader:

  Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.images);
  fillBMPshader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
  mPaint.setShader(fillBMPshader); 
like image 126
Nouman Bhatti Avatar answered Sep 04 '25 19:09

Nouman Bhatti