Skip to content

Walll-E/HorizontalNumProgressbar

Repository files navigation

HorizontalNumProgressbar

一个继承自view的水平进度条,默认显示当前进度,也可隐藏。 可以设置进度条的高度,当前进度,最大进度,颜色等。 ##特色

  • 可以监听当前进度变化
  • 可以设置文本的外边框和文本的显示
  • 支持设置进度条高度,当前进度字体大小
  • 支持设置进度条颜色,外边框颜色,当前进度字体颜色

###基本使用:

1.在project的 build.gradle下

allprojects { 
    repositories {  
        ...   
        maven { url 'https://jitpack.io' } 
        } 
    }

2.在app 的 build.gradle下

dependencies {         
    compile 'com.github.Walll-E:HorizontalNumProgressbar:v1.0' 
}

###用法: 布局文件中声明:

<com.walle.progressbar.NumberProgressBar      
        android:layout_width="match_parent"    
        android:layout_height="wrap_content"    
        app:progress_current="60"    
        android:layout_margin="10dp"    
        app:progress_reached_bar_height="10dp"    
        app:progress_unreached_bar_height="10dp"    
        app:progress_out_bar_height="15dp"    
        app:progress_max="100"    
        app:progress_text_color="@android:color/holo_red_light"    
        app:progress_text_size="12dp"    
        app:progress_unreached_color="#999999"    
        app:progress_out_bar_color="@color/colorAccent"/>
        
代码中动态设置进度:
    progressBar.setOnProgressBarListener(this);   
    timer = new Timer();    
    timer.schedule(new TimerTask() {        
        @Override        
        public void run() {            
            runOnUiThread(new Runnable() {               
              @Override                
              public void run() {                   
                 //progressBar 进度递增方法                    
                 progressBar.incrementProgressBy(1);                
              }           
           });        
        }  
      },2000,100);
       
        /** 
        * 
        进度变化监听
        * @param current 当前进度
        * @param max 最大进度 
        *
        /@Override
        public void onProgressChange(int current, int max) { 
        //具体操作
        }
        
##关于我
 [简书](http://www.jianshu.com/u/f914004db506) 
 [github主页](https://github.com/Walll-E)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages