13

how to get parseColor color value to transparent.

mPaint.setColor(Color.parseColor("#FFFF00"));

thanks for help

Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
Fou
  • 896
  • 2
  • 8
  • 19
  • Check out this answer: http://stackoverflow.com/questions/15852122/hex-transparency-in-colors – Jaz May 11 '15 at 14:02

4 Answers4

31

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.

iphondroid
  • 498
  • 7
  • 19
Mohammad Arman
  • 7,020
  • 2
  • 36
  • 50
7

just used android color string

mPaint.setColor(getResources().getColor(android.R.color.transparent));
Angad Tiwari
  • 1,738
  • 1
  • 12
  • 23
1

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

CrackerKSR
  • 1,380
  • 1
  • 11
  • 29
0

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.

Knossos
  • 15,802
  • 10
  • 54
  • 91