Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A fancy CircularProgressView

License

NotificationsYou must be signed in to change notification settings

GuilhE/CircularProgressView

Android ArsenalPreview-Appetize.io

A fancy CircularProgressView.

Installation

CircularProgressView is distributed throughMaven Central andJitpack.

implementation'com.github.guilhe:circular-progress-view:${LATEST_VERSION}'

Maven Central

Usage

Check out thesample module where you can find a few examples of how to create it byxml orjava.

Attributes accepted in xml:

    <attrname="max"format="integer" />    <attrname="shadow"format="boolean" />    <attrname="progressThumb"format="boolean" />    <attrname="progressThumbSize"format="dimension" />    <attrname="progressThumbSizeRate"format="float" />    <attrname="progressThumbSizeMaxRate"format="float" />    <attrname="startingAngle"format="integer" />    <attrname="progress"format="integer" />    <attrname="progressBarThickness"format="dimension" />    <attrname="progressBarColor"format="color" />    <attrname="progressBarColorArray"format="reference" />    <attrname="progressBarColorArrayPositions"format="reference" />    <attrname="duplicateFirstColorInArray"format="boolean" />    <attrname="progressBarRounded"format="boolean" />    <attrname="progressBackgroundColor"format="color" />    <attrname="progressBackgroundAlphaEnabled"format="boolean" />    <attrname="reverse"format="boolean" />    <attrformat="enum"name="progressThumbScaleType">        <enumname="auto"value="0"/>        <enumname="point"value="1"/>        <enumname="rate"value="2"/>    </attr>

Example:

<com.github.guilhe.views.CircularProgressViewandroid:layout_width="100dp"android:layout_height="100dp"app:progress="60"app:progressBarThickness="10dp"app:progressBarColor="@android:color/holo_purple"/>

BindingAdapters

You can take advantage ofBinding Adapters (from Data Binding) to create some helper attributes, example:

@BindingAdapter("progressAnimated")funsetProgressAnimated(view:CircularProgressView,progress:Int) {    view.setProgress(progress,true);}
<com.github.guilhe.views.CircularProgressView    ...app:progressAnimated="@{viewModel.progress}"/>

Progress with gradient

For the given array of colors:

<arrayname="rainbow">    <item>#FFF60000</item>    <item>#FFFF8C00</item>    <item>#FFFFEE00</item>    <item>#FF4DE94C</item>    <item>#FF3783FF</item>    <item>#FF4815AA</item></array>

The default result will be (left):

To achieve the result on the right side you have two options: either copy the first color and add it as last, or use the helper attribute/method that does that for you:

<attrname="duplicateFirstColorInArray"format="boolean"/>
funsetProgressColors(@NonNull @ColorInt int[] colors, @Nullable float[] positions, boolean duplicateFirst)

Finally, you may also use the attributeprogressBarColorArrayPositions to pass afloat[] positions:

<arrayname="rainbow_positions">    <itemtype="dimen"format="float">.44</item>    ...</array>

note: when using the helper functionandpositions[], you'll have to add an extra position for the last one being copied.

There are many methods to help you customize thisView by code. For more details checkout thesample app,javadocs or the code itself.

"Multiple Progress" for PieChart

funsetProgress(@NonNullList<Float> progressList, @NonNullList<Integer> progressColorList)

This mode can be used to display a simple pie chart. It will disable the progress thumb, the background color and the progress will not be round.

Sample

Sample

Animation last update on April, 2019

Get it on Google Play

Dependencies

Bugs and Feedback

For bugs, questions and discussions please use theGithub Issues.

LICENSE

Copyright (c) 2017-present, GuilhE.

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, softwaredistributed 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 andlimitations under the License.

Sponsor this project

    Packages

    No packages published

    Languages


    [8]ページ先頭

    ©2009-2026 Movatter.jp