Android SweepGradient - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android SweepGradient class.

This code example shows how to use the following methods:
        private final Matrix mMatrix3;
 
        public GradientsView(Context c) {
            super(c);
 
            mSweepGradient = new SweepGradient(0.0f, 0.0f, 0xff000000, 0xffffffff);
            mRadialGradient = new RadialGradient(0.0f, 0.0f, 100.0f, 0xff000000, 0xffffffff,
                    Shader.TileMode.MIRROR);
             
            mMatrix = new Matrix();
            mMatrix.setRotate(-45, 0.0f, 0.0f);
            mMatrix.postTranslate(100.0f, 100.0f);
 
            mMatrix2 = new Matrix();
            mMatrix2.setScale(1.0f, 2.0f);
            mMatrix2.postRotate(-45, 0.0f, 0.0f);
 
            mMatrix3 = new Matrix();
            mMatrix3.setTranslate(100.0f, 100.0f);            
             
7
CodeRank
This code example shows how to use the following methods:
        private final Paint mPaint;
 
        SweepGradientView(Context c) {
            super(c);
 
            SweepGradient gradient = new SweepGradient(100.0f, 100.0f, 0xff000000, 0xffffffff);
            mPaint = new Paint();
            mPaint.setShader(gradient);
        } 
 
        @Override 
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
            setMeasuredDimension(200, 200); 
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
6
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
        private final Matrix mMatrix3;
 
        public GradientsView(Context c) {
            super(c);
 
            mSweepGradient = new SweepGradient(0.0f, 0.0f, 0xff000000, 0xffffffff);
            mRadialGradient = new RadialGradient(0.0f, 0.0f, 100.0f, 0xff000000, 0xffffffff,
                    Shader.TileMode.MIRROR);
             
            mMatrix = new Matrix();
            mMatrix.setRotate(-45, 0.0f, 0.0f);
            mMatrix.postTranslate(100.0f, 100.0f);
 
            mMatrix2 = new Matrix();
            mMatrix2.setScale(1.0f, 2.0f);
            mMatrix2.postRotate(-45, 0.0f, 0.0f);
 
            mMatrix3 = new Matrix();
            mMatrix3.setTranslate(100.0f, 100.0f);            
             
6
CodeRank
This code example shows how to use the following methods:
 
        mColors = new int[] {
            0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00, 
            0xFFFFFF00, 0xFFFF0000 
        }; 
        Shader s = new SweepGradient(0, 0, mColors, null);
         
        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setShader(s);
        mPaint.setStyle(Paint.Style.STROKE);
         
        mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mCenterPaint.setStrokeWidth(5);
	} 
     
    private boolean mTrackingCenter;
    private boolean mHighlightCenter;
 
    @Override  
    protected void onDraw(Canvas canvas) {
5
CodeRank
This code example shows how to use the following methods:
            mListener = l;
            mColors = new int[] {
                0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00, 
                0xFFFFFF00, 0xFFFF0000 
            }; 
            Shader s = new SweepGradient(0, 0, mColors, null);
             
            mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
            mPaint.setShader(s);
            mPaint.setStyle(Paint.Style.STROKE);
            mPaint.setStrokeWidth(32);
             
            mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
            mCenterPaint.setColor(color);
            mCenterPaint.setStrokeWidth(5);
        } 
         
        private boolean mTrackingCenter;
        private boolean mHighlightCenter;
 
4
CodeRank
This code example shows how to use the following methods:
 
        mColors = new int[] {
            0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00, 
            0xFFFFFF00, 0xFFFF0000 
        }; 
        Shader s = new SweepGradient(0, 0, mColors, null);
         
        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setShader(s);
        mPaint.setStyle(Paint.Style.STROKE);
         
        mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mCenterPaint.setStrokeWidth(5);
	} 
     
    private boolean mTrackingCenter;
    private boolean mHighlightCenter;
 
    @Override  
    protected void onDraw(Canvas canvas) {
4
CodeRank
This code example shows how to use the following methods:
            mListener = l;
            mColors = new int[] {
                0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00, 
                0xFFFFFF00, 0xFFFF0000 
            }; 
            Shader s = new SweepGradient(0, 0, mColors, null);
             
            mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
            mPaint.setShader(s);
            mPaint.setStyle(Paint.Style.STROKE);
            mPaint.setStrokeWidth(32);
             
            mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
            mCenterPaint.setColor(color);
            mCenterPaint.setStrokeWidth(5);
        } 
         
        private boolean mTrackingCenter;
        private boolean mHighlightCenter;
 
4
CodeRank
This code example shows how to use the following methods:
            mListener = l;
            mColors = new int[] {
                0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00, 
                0xFFFFFF00, 0xFFFF0000 
            }; 
            Shader s = new SweepGradient(0, 0, mColors, null);
             
            mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
            mPaint.setShader(s);
            mPaint.setStyle(Paint.Style.STROKE);
            mPaint.setStrokeWidth(32);
             
            mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
            mCenterPaint.setColor(color);
            mCenterPaint.setStrokeWidth(5);
        } 
         
        private boolean mTrackingCenter;
        private boolean mHighlightCenter;
 
4
CodeRank
This code example shows how to use the following methods:
        		Color.BLACK, Color.BLUE, Color.RED, Color.WHITE};
        /*mColors = new int[] { 
            0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0x00000000, 0xFFFFFFFF, 0xFF00FF00, 
            0xFFFFFF00, 0xFFFF0000 
        };*/ 
        Shader s = new SweepGradient(0, 0, mColors, null);
         
        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setShader(s);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeWidth(32);
         
        mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mCenterPaint.setColor(color);
        mCenterPaint.setStrokeWidth(5);
    } 
     
    private boolean mTrackingCenter;
    private boolean mHighlightCenter;
 
4
CodeRank

Related Android SweepGradient Questions & Answers:

See Code Examples for Android SweepGradient Methods: