Reputation: 100
I want to create a line with different colors in two ways like:
Something like a progress bar but with different colors
Something like a table but with different colors(not different cell background)
I want to for example write some code and say the min and max point of the periods and it show me the period in some color (like red) on a line.
so is there any way that I can draw them in my jar file?(I mean the jar file that is connected to activity like MainActivity.jar) I use Android Studio v 1.0.2
Thanks for your useful helps:)
Upvotes: 0
Views: 762
Reputation: 2223
Use GradientDrawable
.
GradientDrawable rainbow = new GradientDrawable(Orientation.LEFT_RIGHT,
new int[] {Color.RED, Color.MAGENTA, Color.BLUE, Color.CYAN, Color.GREEN, Color.YELLOW, Color.RED});
The docs tell you how to set shape, interpolation between colors, position of colors, etc.
Upvotes: 1