Reputation: 31
I want to change color to used in the following example to brown, but my attempts are not working:
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setColor(Color.RED);
This doesn't work:
mPaint.setColor(Color.Brown);
nor does this:
mPaint.setColor(mPaint.setColor(0x00994C00));
It only works when I change the color to to RED
, GREEN
, BLUE
, CYAN
, MAGENTA
.
Can someone help me to solve this problem?
Upvotes: 1
Views: 2556
Reputation: 164
Try:
mPaint.setColor(Color.argb(0xff, 0x99, 0x4c, 0x00));
or:
mPaint.setColor(0xff994c00);
Upvotes: 6
Reputation: 23881
Try this
int myColor= getApplicationContext().getResources().getColor(com.package_name.R.color.white);
mPaint.setColor(myColor);
define white color in your color.xml file
Upvotes: 1