anastr / SpeedView

Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:
Apache License 2.0
1.28k stars 321 forks source link

TubeSpeedometer - setColor function missing #209

Closed akshayc04 closed 3 years ago

akshayc04 commented 3 years ago

1) The TubeSpeedometer is missing setSpeedometerColor() special function. Also, app:sv_speedometerColor="" is not working from the special attributes.

2) Earlier TubeSpeedometer allowed to change low,medium and high speed colors, but that is not available now.

Previous version used: 1.3.1 Current Version: 1.5.5

anastr commented 3 years ago

Hi @akshayc04, Speedometer color for this type of speedometers is directed by Sections. Please try to change section color in java/ kotlin code to see the change in action.

akshayc04 commented 3 years ago

Hi @anastr , Thanks for getting back! Can you explain what do you mean by change section color? Can you give an example for the tubespeedometer? Say I want to change the low, medium and high speed colors.

anastr commented 3 years ago

If you look at Section part of the description, you will see you can change colors with:

// Change low section's color.
speedometer.sections[0].color = Color.GREEN
// By default there are 3 sections.

Or you may add your own sections:

// first remove all old sections.
speedometer.clearSections()
speedometer.addSections(
        // First section (from 0 to 33%).
        Section(0f, .33f, Color.LTGRAY),
        // Second section (from 33% to 66%).
        Section(.33f, .66f, Color.YELLOW),
        Section(.66f, 1f, Color.BLUE),
)