I am using following code to apply font color when user click on perticular color like RED.
mPaint.setColor(getResources().getColor(R.color.color2));
And color2 in color.xml
file is
<color name="color2">#FF3C00</color>
Now I am facing problem while applying following color.
I using canvas to draw paint on touching it in my application and i want to draw something like attached screen on canvas. I am able to draw it but It looks like solid color (I mean full circle but not dot dot inside)
Please help me to find this.
You can use BitmapShader for achieve that..
Here is sample code.. Try this code, I hope it will work..
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.shader);
//Initialize the BitmapShader with the Bitmap object and set the texture tile mode
BitmapShader mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
fillPaint.setStyle(Paint.Style.FILL);
//Assign the 'fillBMPshader' to this paint
fillPaint.setShader(mBitmapShader);
//Draw the fill of any shape you want, using the paint object.
canvas.drawCircle(posX, posY, 100, fillPaint);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With