Skip to content
Anas Altair edited this page Nov 26, 2016 · 15 revisions

Start and End Degree

you can change the default start degree 135 and End Degree 405 easily.

in XML use app:startDegree and app:endDegree attributes :

<com.github.anastr.speedviewlib.SpeedView
        android:id="@+id/speedView"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        app:startDegree="180"
        app:endDegree="360" />

in code use setStartDegree(int) and setEndDegree(int) methods :

speedView.setStartDegree(180);
speedView.setEndDegree(270);

Control division of the speedometer

now you can change the long of lowSpeed and mediumSpeed segments.

in XML use lowSpeedPercent and mediumSpeedPercent attributes :

<com.github.anastr.speedviewlib.SpeedView
        android:id="@+id/speedView"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        app:lowSpeedPercent="50"
        app:mediumSpeedPercent="75" />

in code use setLowSpeedPercent(int) and setMediumSpeedPercent(int) methods :

speedView.setLowSpeedPercent(25);
speedView.setMediumSpeedPercent(75);

support Right to Left

if you want to add Right to Left language (like Arabic) just use app:speedometerTextRightToLeft="true" attribute in XML, and setSpeedometerTextRightToLeft(true) method in code.
look at the text in this image: