private void customDraw(Canvas canvas) {
        int width = getMeasuredWidth();
        int height = getMeasuredHeight();
        Path path = gotPath(width, height);
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        int[] colors = new int[]{
                ContextCompat.getColor(getContext(), R.color.hlklib_bezier_curve_background_start),
                ContextCompat.getColor(getContext(), R.color.hlklib_bezier_curve_background_center),
                ContextCompat.getColor(getContext(), R.color.hlklib_bezier_curve_background_end)
        };
        Shader shader = new LinearGradient(0, height, width, 0, colors, null, Shader.TileMode.MIRROR);
        paint.setShader(shader);
        paint.setStyle(Paint.Style.FILL);
        canvas.drawPath(path, paint);
    }
private void customDraw ( Canvas canvas ) { int width = getMeasuredWidth ( ) ; int height = getMeasuredHeight ( ) ; Path path = gotPath ( width , height ) ; Paint paint = new Paint ( ) ; paint . setAntiAlias ( true ) ; int [ ] colors = new int [ ] { ContextCompat . getColor ( getContext ( ) , R . color . hlklib_bezier_curve_background_start ) , ContextCompat . getColor ( getContext ( ) , R . color . hlklib_bezier_curve_background_center ) , ContextCompat . getColor ( getContext ( ) , R . color . hlklib_bezier_curve_background_end ) } ; Shader shader = new LinearGradient ( 0 , height , width , 0 , colors , null , Shader . TileMode . MIRROR ) ; paint . setShader ( shader ) ; paint . setStyle ( Paint . Style . FILL ) ; canvas . drawPath ( path , paint ) ; }
自定义绘制