Skip to content

4. RaySpeedometer

Anas Altair edited this page Jul 27, 2020 · 5 revisions

speedometer with Blur Effects and without indicator.

simple usage

add to xml Layout:

<com.github.anastr.speedviewlib.RaySpeedometer
        android:id="@+id/raySpeedometer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

define speedometer in the code.

RaySpeedometer raySpeedometer= (RaySpeedometer) findViewById(R.id.raySpeedometer);

// change speed to 50 Km/h
raySpeedometer.speedTo(50);

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

special methods

// change the degree between the marks
raySpeedometer.setDegreeBetweenMark(3); //def : 5
// change marks width
raySpeedometer.setRayMarkWidth(2); //def : 3dp
// change Ray (the lines) color
raySpeedometer.setRayColor(Color.RED);
// set or remove Blur Effects.
raySpeedometer.setWithEffects(false);
// change Background Color of speed text.
raySpeedometer.setSpeedBackgroundColor(Color.RED);

special Attributes

app:sv_withEffects="false" <!-- def : true -->
app:sv_speedBackgroundColor="#000077"
app:sv_rayColor="#d8ff0000" <!-- def : WHITE -->
app:sv_degreeBetweenMark="7" <!-- def : 5 -->
app:sv_rayMarkWidth="5dp" <!-- def : 3dp -->