In map activity i created overlay on which on Cnavas
i draw shapes using Paint
Shape consists from points and lines
linePaint = new Paint();
linePaint.setColor(mContext.getResources().getColor(R.color.Line));
linePaint.setStyle(Paint.Style.STROKE);
linePaint.setStrokeWidth(strokeWidth);
linePaint.setXfermode(avoidXfermode);
linePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
mPointPaint = new Paint();
mPointPaint.setColor(pointColor);
mPointPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
Also I define AvoidXfermode
to avoid points overlapping with lines (points must be "on top")
avoidXfermode = new AvoidXfermode(pointColor, 255, Mode.AVOID);
colors defined in resources in 32b format
<color name="Point">#FFFF0000</color>
<color name="Line">#FF4169E1</color>
The problem is: it works fine on devices with api 10, but it doesn't work at all under Nexus with api v14 (with any tolerance)
What I do wrong?
AvoidXfermode is not supported with hardware acceleration.
You can determine that with View.isHardwareAccelerated() and set it with View.setLayerType(LAYER_TYPE_*). Although you might need to look for alternatives.
You can read about it here http://developer.android.com/guide/topics/graphics/hardware-accel.html#unsupported