velocimeter-view android的測速儀效果的進度條 ,自定義VelocimeterView 的一個圓形進度條,
設置 app:inside_progress_color, app:external_progress_color,app:progress_blur_color
, app:bottom_velocimeter_color, app:internal_velocimeter_color等幾層view疊加實現的。html
運行效果:android
源碼:git
package com.github.glomadrian.velocimeter;github
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.SeekBar;
import com.github.glomadrian.velocimeterlibrary.VelocimeterView;app
public class MainActivity extends AppCompatActivity {ide
private SeekBar seek;
private VelocimeterView velocimeter;
private VelocimeterView velocimeter2;spa
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
seek = (SeekBar) findViewById(R.id.seek);
seek.setOnSeekBarChangeListener(new SeekListener());
velocimeter = (VelocimeterView) findViewById(R.id.velocimeter);
velocimeter2 = (VelocimeterView) findViewById(R.id.velocimeter2);
}code
private class SeekListener implements SeekBar.OnSeekBarChangeListener {htm
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
velocimeter.setValue(progress, true);
velocimeter2.setValue(progress, true);
}ci
@Override public void onStartTrackingTouch(SeekBar seekBar) {
//Empty
}
@Override public void onStopTrackingTouch(SeekBar seekBar) {
//Empty
}
}
}
項目完整源碼:http://www.itlanbao.com/code/20150915/10000/100529.html