E-mail: [email protected]
JitPack: JitPack Link
This is a simple custom ProgressBar. Two classes are included, one is Horizontal styled and another is Circular styled.
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
compile 'com.github.Harlan1994:Progress:v1.0.0'
There 7 custom attrs can be used whitch can be seen in values. In your xml files, use the following attributes.
<com.harlan.progressbar.LineProgressBar
...
harlan:textSize="14sp"
harlan:reachColor="#0ff"
harlan:unreachColor="#0b0"
harlan:reachHeight="5dp"
harlan:unreachHeight="3dp"
harlan:textColor="@color/colorAccent"
harlan:textOffset="10dp"
.../>
<com.harlan.progressbar.CircleProgressBar
...
harlan:radius="45dp"
harlan:reachHeight="6dp"
harlan:unreachHeight="4dp"
harlan:textColor="#0ff"
harlan:textSize="15sp"
.../>
public class MainActivity extends AppCompatActivity {
private LineProgressBar lineProgressBar1, lineProgressBar2;
private CircleProgressBar circleProgressBar1, circleProgressBar2;
private int progress = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
...
lineProgressBar1 = (LineProgressBar) findViewById(R.id.line1);
lineProgressBar2 = (LineProgressBar) findViewById(R.id.line2);
circleProgressBar1 = (CircleProgressBar) findViewById(R.id.circle1);
circleProgressBar2 = (CircleProgressBar) findViewById(R.id.circle2);
mHandler.sendEmptyMessageDelayed(1, 200);
}
private Handler mHandler = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
progress++;
lineProgressBar1.setProgress(progress);
lineProgressBar2.setProgress(progress);
circleProgressBar1.setProgress(progress);
circleProgressBar2.setProgress(progress);
mHandler.sendEmptyMessageDelayed(1, 200);
}
};
}
[iMooc video]http://www.imooc.com/ @GcsSloop
Copyright 2015 Harlan1994
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.