-
-
Notifications
You must be signed in to change notification settings - Fork 324
Indicators
since version 1.1.2
you can change the indicator, or remove it for All Speedometers.
just for Speedometer family.
add app:sv_indicator=""
attribute (enum value) to your speedometer to change the indicator.
like so:
<com.github.anastr.speedviewlib.SpeedView
android:layout_width="300dp"
android:layout_height="wrap_content"
app:sv_indicator="TriangleIndicator" />
speedometer.setIndicator(Indicator.Indicators.SpindleIndicator)
indicator Name | Screenshot | indicator Name | Screenshot |
---|---|---|---|
NoIndicator | NormalIndicator | ||
TriangleIndicator | NormalSmallIndicator | ||
SpindleIndicator | LineIndicator | ||
HalfLineIndicator | QuarterLineIndicator | ||
KiteIndicator | NeedleIndicator |
indicator is Observable by its Speedometer, so.. one indicator must be added to one speedometer.
and so, to change width or color you can call immediately speedometer.indicator.width = 20f
or speedometer.indicator.color = Color.BLUE
without tack care of invalidate the SpeedView, because it's observing any change to indicator and do auto invalidate.
also you can change width and color in XML:
sv_indicatorColor=""
sv_indicatorWidth=""
you can add custom indicator, just add indicator's image to your drawable folder, and use ImageIndicator Object.
must set the center of indicator in the center of image, and the indicator towards the top,just like this one:
to create object you cans use: ImageIndicator(context: Context, resource: Int)
eysly, but we Recommend to use ImageIndicator(context: Context, resource: Int, width: Int, height: Int)
to add custom width and height for indicator.
val imageIndicator = ImageIndicator(getApplicationContext(), R.drawable.image_indicator1)
speedometer.indicator = imageIndicator
if you have any idea, image, template please open new issue and give me the image , and i well try to add it to the Library, it must be possible to drawn, if you like this library you can support it.