项目作者: yuriy-budiyev

项目描述 :
Circular progress bar
高级语言: Java
项目地址: git://github.com/yuriy-budiyev/circular-progress-bar.git
创建时间: 2017-08-28T10:38:28Z
项目社区:https://github.com/yuriy-budiyev/circular-progress-bar

开源协议:MIT License

下载


Circular Progress Bar

Release
Android Arsenal
API

Circular progress bar, supports animations and indeterminate mode, highly customizable, Kotlin-friendly

Usage (sample)

Step 1. Add it in your root build.gradle at the end of repositories:

  1. allprojects {
  2. repositories {
  3. maven { url 'https://jitpack.io' }
  4. }
  5. }

or in settings.gradle file:

  1. dependencyResolutionManagement {
  2. repositories {
  3. maven { url 'https://jitpack.io' }
  4. }
  5. }

Step 2. Add dependency:

  1. dependencies {
  2. implementation 'com.github.yuriy-budiyev:circular-progress-bar:1.2.3'
  3. }

Define a view in your layout file:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FrameLayout
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. xmlns:app="http://schemas.android.com/apk/res-auto"
  5. android:layout_width="match_parent"
  6. android:layout_height="match_parent">
  7. <com.budiyev.android.circularprogressbar.CircularProgressBar
  8. android:id="@+id/progress_bar"
  9. android:layout_width="64dp"
  10. android:layout_height="64dp"
  11. app:animateProgress="true"
  12. app:backgroundStrokeColor="#ff3f51b5"
  13. app:backgroundStrokeWidth="2dp"
  14. app:drawBackgroundStroke="false"
  15. app:foregroundStrokeCap="butt"
  16. app:foregroundStrokeColor="#ffff4081"
  17. app:foregroundStrokeWidth="3dp"
  18. app:indeterminate="false"
  19. app:indeterminateRotationAnimationDuration="1200"
  20. app:indeterminateSweepAnimationDuration="600"
  21. app:indeterminateMinimumAngle="45"
  22. app:maximum="100"
  23. app:progress="50"
  24. app:progressAnimationDuration="100"
  25. app:startAngle="270"></com.budiyev.android.circularprogressbar.CircularProgressBar>
  26. </FrameLayout>

And (or) add following code to your activity:

Kotlin

  1. class MainActivity : AppCompatActivity() {
  2. override fun onCreate(savedInstanceState: Bundle?) {
  3. super.onCreate(savedInstanceState)
  4. setContentView(R.layout.activity_main)
  5. val progressBar = findViewById<CircularProgressBar>(R.id.progress_bar)
  6. progressBar.progress = 30f
  7. }
  8. }

Java

  1. public class MainActivity extends AppCompatActivity {
  2. @Override
  3. protected void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.activity_main);
  6. CircularProgressBar progressBar = findViewById(R.id.progress_bar);
  7. progressBar.setProgress(30f);
  8. }
  9. }

Progress bar can be fully configured from code

Preview

Preview screenshot