Reputation: 916
how to get parseColor color value to transparent.
mPaint.setColor(Color.parseColor("#FFFF00"));
thanks for help
Upvotes: 14
Views: 34037
Reputation: 1877
You can use Color.TRANSPARENT if you do not want to change the transparency level.
import android.graphics.Color;
// use Color.TRANSPARENT
mPaint.setColor(Color.TRANSPARENT);
https://developer.android.com/reference/android/graphics/Color#TRANSPARENT
Upvotes: 2
Reputation: 7065
Suppose your preferred color is red #FF0000
Adding 00 in the beginning will make it 100% transparent and adding FF will make it 100% solid.
So, 100% transparent color is: #00ff0000
and 100% solid color is: #ffff0000
And any value in between 00
to ff
can be used to adjust the transparency.
Upvotes: 32
Reputation: 1768
just used android color string
mPaint.setColor(getResources().getColor(android.R.color.transparent));
Upvotes: 7
Reputation: 16038
You can use Color.argb(int alpha, int red, int green, int blue)
Alpha corresponds to transparency. 0 for fully transparent. 255 for opaque.
http://developer.android.com/reference/android/graphics/Color.html#argb(int,%20int,%20int,%20int)
Return a color-int from alpha, red, green, blue components. These component values should be [0..255], but there is no range check performed, so if they are out of range, the returned color is undefined.
Upvotes: 0