我想在 中实现一个LinearGradient
效果SurfaceView
,但是显示不流畅。它在屏幕上显示一些行。是显示器本身的原因吗?这是我的代码:
try {
canvas = sfh.lockCanvas();
canvas.drawColor(Color.TRANSPARENT,Mode.CLEAR);
paint = new Paint();
linearGradient = new LinearGradient(0,0,0,ScreenH,new int[]{Color.argb(230,255,200, 236),Color.argb(200,255, 153,153)},null,TileMode.CLAMP);
paint.setShader(linearGradient);
paint.setAntiAlias(true);
paint.setDither(true);
canvas.drawPaint(paint);
} catch (Exception ex) {
} finally {
if (canvas != null)
sfh.unlockCanvasAndPost(canvas);
}