Skip to content

Indicators

Anas Altair edited this page Jan 10, 2017 · 10 revisions

Work with Indicators

from version 1.1.2 you can change the indicator, or remove it for All Speedometers.

in XML

add app: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:indicator="TriangleIndicator" />

in Code

speedometer.setIndicator(Indicator.Indicators.SpindleIndicator);

All indicators

indicator Name Screenshot indicator Name Screenshot
NoIndicator NormalIndicator
TriangleIndicator NormalSmallIndicator
SpindleIndicator LineIndicator
HalfLineIndicator QuarterLineIndicator

ImageIndicator

you can add custom indicator, just add indicator's image to your drawable folder, and use ImageIndicator Object.
to create object you cans use: new ImageIndicator(Context context, int resource) eysly, but we Recommend to use new ImageIndicator(Context context, int resource, int width, int height) to add custom width and height for indicator.

ImageIndicator imageIndicator = new ImageIndicator(getApplicationContext(), R.drawable.image_indicator1);

speedometer.setIndicator(imageIndicator);

look at Style page to see how you can change the color and width.