Skip to content

7. ImageSpeedometer

Anas Altair edited this page Dec 25, 2016 · 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:imageSpeedometer="@drawable/your_image" />

to remove speed text and unit text just add:

app:speedTextColor="@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:imageSpeedometer="@drawable/your_image"