4

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?

1
  • I have managed to solve this. Commented Jan 25, 2011 at 5:46

2 Answers 2

10

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); 
Sign up to request clarification or add additional context in comments.

Comments

1

I was able to apply texture to paint object with the help of BitmapShader. The example above applies texture to the rim and I applied the same logic to apply texture to hand. It works.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.