Skip to content

7. ImageSpeedometer

Anas Altair edited this page Mar 11, 2017 · 6 revisions

speedometer to add custom image, you can design speedometer image in Photoshop or illustrator.... and add it to drawable folder, this speedometer has No indicator, look at indicators to add one.

simple usage

add to xml Layout, add app:imageSpeedometer attribute (Required):

<com.github.anastr.speedviewlib.ImageSpeedometer
        android:id="@+id/imageSpeedometer"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        app:sv_image="@drawable/your_image" />

Recommended square image.

to remove speed text and unit text just add:

app:sv_speedTextColor="@android:color/transparent"
app:sv_unitTextColor="@android:color/transparent"

define speedometer in the code.

ImageSpeedometer imageSpeedometer = (ImageSpeedometer) findViewById(R.id.imageSpeedometer);

// change speed to 140 Km/h
imageSpeedometer.speedTo(140);

you can see all methods And Attributes at Get Started - Wiki.

special methods

// change image.
imageSpeedometer.setImageSpeedometer(R.drawable.your_image);

special Attributes

app:sv_image="@drawable/your_image"