码迷,mamicode.com
首页 > 移动开发 > 详细

velocimeter-view android测速仪效果

时间:2015-09-16 09:48:58      阅读:278      评论:0      收藏:0      [点我收藏+]

标签:

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叠加实现的。

 

运行效果:

技术分享

源码:

package com.github.glomadrian.velocimeter;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.SeekBar;
import com.github.glomadrian.velocimeterlibrary.VelocimeterView;

public class MainActivity extends AppCompatActivity {

  private SeekBar seek;
  private VelocimeterView velocimeter;
  private VelocimeterView velocimeter2;

  @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);
  }

  private class SeekListener implements SeekBar.OnSeekBarChangeListener {

    @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
      velocimeter.setValue(progress, true);
      velocimeter2.setValue(progress, true);
    }

    @Override public void onStartTrackingTouch(SeekBar seekBar) {
      //Empty
    }

    @Override public void onStopTrackingTouch(SeekBar seekBar) {
      //Empty
    }
  }
}

 

项目完整源码:http://www.itlanbao.com/code/20150915/10000/100529.html

velocimeter-view android测速仪效果

标签:

原文地址:http://my.oschina.net/u/2449503/blog/506555

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!