love-311 / PercentProgressBar

一款拖动改变百分比大小的自定义View控件。。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PercentProgressBar

API

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file):

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

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
	...
	 compile 'com.github.love-311:PercentProgressBar:1.0'
}

Use

A simple in xml:

 <www.lee311.percentprogressbar.PercentProgressBar
        android:id="@+id/percent_progress_bar"
        android:layout_width="368dp"
        android:layout_height="205dp"
        app:bgColor="@color/red"
        app:iconBitmap="@mipmap/transfer_icon_handle"
        app:iconPadding="20dp"
        app:progressColor="@color/green"
        app:progressMax="100"
        app:progressOrientation="horizontal"
        app:progressValue="0"/>

Method

to set the total value:

mPercentProgressBar.setTotal(329990);

to set current progress:

mPercentProgressBar.setProgress(30);

to set the text size:

mPercentProgressBar.setTextSize(64);

to set the text color:

mPercentProgressBar.setTextColor(getResources().getColor(R.color.colorPrimary));

to set the listener of the progress chanage:

mPercentProgressBar.setChangedListener(new PercentProgressBar.OnProgressChangedListener() {
            @Override
            public void onProgressChanged(int currentValue, int percent) {
                
            }
        });

About

一款拖动改变百分比大小的自定义View控件。。


Languages

Language:Java 100.0%