Questions tagged [sweepgradient]
7 questions
20
votes
2 answers
Sweep Gradient : What it is and its examples
I came across Sweep Gradient on Android and was intrigued if it could give me a better control over the Color spacing and transitions. Did a quick search and found almost nothing about it!!
The only few references I found (and they do not meet the…

Kaushik NP
- 6,733
- 9
- 31
- 60
4
votes
1 answer
SweepGradient change position of start and end color
I want to create a CircleView with gradient from bottom -> left -> top -> right.
So I using canvas with SweepGradient like this
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint paint = new Paint();
int[] colors =…

Linh
- 57,942
- 23
- 262
- 279
1
vote
1 answer
Drawing a rainbow colored ring in android
I've been trying to draw a rainbow colored ring in android using the following code:
public void init(){
ringPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
ringPaint.setStyle(Paint.Style.STROKE);
ringPaint.setStrokeWidth(8f);
…

Joel Robinson-Johnson
- 929
- 1
- 7
- 19
1
vote
0 answers
Make gradient smoother - Android
Here is what i got.
Is it possible to discard fragmentation or at least make it smoother?
I read pixel color from running cursor and on low speed fragmentation is visible.
Here is my code:
final int[] mColors = new int[] {
0xFFFF0000,…

JuicyKitty
- 318
- 1
- 16
1
vote
0 answers
Android SweepGradient and Drawing Lines in a circular pattern
I am trying to achieve this circular progress bar with gradient intervals UI effect
Currently I have been able to achieve this.
The code for my current implementation is below.
import android.content.Context;
import android.graphics.Canvas;
import…

user2536851
- 314
- 3
- 11
0
votes
1 answer
Layout background with SweepGradient
I need to create a multicolor background like in the picture. I know all colors and angles.
I try to do this with SweepGradient, but nothing change, I see only white background.
A piece of my layout

Delphian
- 1,650
- 3
- 15
- 31
0
votes
2 answers
SweepGradient ArrayIndexOutOfBoundsException
I create a SweepGradient like this
int[] colors = { Color.RED, Color.BLUE };
// float[] positions = {0,1}; => this will work without error
float[] positions = { 0 , 280f/360 };
SweepGradient gradient = new SweepGradient(width / 2, height / 2,…

Linh
- 57,942
- 23
- 262
- 279