ProgressWheel: progress bar of the Android open-source ring,
This is a custom Android component that replaces the standard progress bar component. Implement various progress bar styles, including rings and scans.
XML:
Add the following to your attr. xml (res/value ):
12345678910111213141516 |
<Declare-styleable name = "ProgressWheel"> <attr name = "text" format = "string"/> <attr name = "textColor" format = "color"/> <attr name = "textSize" format = "dimension"/> <attr name = "barColor" format = "color"/> <attr name = "rimColor" format = "color"/> <attr name = "rimWidth" format = "dimension"/> <attr name = "spinSpeed" format = "integer"/> <attr name = "circleColor" format = "color" /> <attr name = "radius" format = "dimension"/> <attr name = "barWidth" format = "dimension"/> <attr name = "barLength" format =" dimension "/> <attr name =" delayMillis "format =" dimension "/> <attr name =" contourColor "format =" color "/> <attr name =" contourSize "format = "float"/> </declare-styleable> |
Add in your root view
1 |
Xmlns: ProgressWheel = "http://schemas.android.com/apk/res/com.visualdenim.schooltraq" |
1 |
Add components where your xml is appropriate |
12345678910111213 |
<Com. todddavies. components. progressbar. progressWheel android: id = "@ + id/pw_spinner" android: layout_width = "200dp" android: layout_height = "200dp" android: layout_centerInParent = "true" ProgressWheel: text = "Authenticating... "ProgressWheel: textColor =" #222 "ProgressWheel: textSize =" 14sp "ProgressWheel: rimColor =" #330097D6 "ProgressWheel: barLength =" 60dp "ProgressWheel: barColor = "#0097D6" ProgressWheel: barWidth = "5dp" ProgressWheel: rimWidth = "2dp"/> |
Java:
You need to get the progress bar from layout or initialize
12 |
ProgressWheel pw = newProgressWheel (myContext, myAttributes); ProgressWheel pw = (ProgressWheel) findViewById (R. id. pw_spinner ); |
Use. spin () to start the progress bar rolling, and stop the progress bar rolling
Adding progress is tricky. You can call it. incrementProgress (), but this is more than 360 degrees, because a circle has 360 degrees, you will automatically reset it when you exceed 360 degrees, and a automatic allocation