前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ProgressBar

ProgressBar

作者头像
用户3004328
发布2018-09-06 17:14:26
8790
发布2018-09-06 17:14:26
举报
文章被收录于专栏:增长技术

CircleSeekbar

an android circle seekbar library

quick start

1.Add root build.gradle
代码语言:javascript
复制
 repositories {
        // ...
        maven { url "https://jitpack.io" }
 }
2.Add build.gradle
代码语言:javascript
复制
dependencies {
	        compile 'com.github.feeeei:CircleSeekbar:v1.0.3'
	}
3.Added to the XML
代码语言:javascript
复制
    <io.feeeei.circleseekbar.CircleSeekBar
        android:id="@+id/seekbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:wheel_max_process="100"
        />

attrs

代码语言:javascript
复制
  <!-- process -->
  <attr name="wheel_max_process" format="integer" />
  <attr name="wheel_cur_process" format="integer" />

  <!-- reached style -->
  <attr name="wheel_reached_color" format="color" />
  <attr name="wheel_reached_width" format="dimension" />

  <!-- unReached style -->
  <attr name="wheel_unreached_color" format="color" />
  <attr name="wheel_unreached_width" format="dimension" />

  <!-- pointer style -->
  <attr name="wheel_pointer_color" format="color" />
  <attr name="wheel_pointer_radius" format="dimension" />

  <!--shadows style -->
  <attr name="wheel_has_pointer_shadow" format="boolean" />
  <attr name="wheel_has_wheel_shadow" format="boolean" />
  <attr name="wheel_pointer_shadow_radius" format="dimension" />
  <attr name="wheel_shadow_radius" format="dimension" />

  <!-- if you want to open the wheel shadow, open this can speed up the rendering speed -->
  <attr name="wheel_has_cache" format="boolean" />

  <!-- if you want to block touchListener,use like processBar,
   only allow the code to control the schedule, you can change this attribute to false -->
  <attr name="wheel_can_touch" format="boolean" />

ProgressView

Custom view scrollbar

自定义view实现下载进度的展示 控件完全自定义,字体大小,圆环宽度,实心或者空心,圆环的宽度,圆环的颜色,进度字体的粗细,字体颜色等等都可以自定义

CircleProgressBar

CircleProgressBar继承ProgressBar, 是包含实心和线条两种风格的圆环进度条. 此外, 进度值可以随意定制. 如果你对酷炫的进度条比较感兴趣, 或许你更喜欢 LoadingDrawable.

用法

Gradle
代码语言:javascript
复制
 dependencies {
    compile 'com.dinuscxj:circleprogressbar:1.1.1'
 }
用在xml中:
代码语言:javascript
复制
<com.dinuscxj.progressbar.CircleProgressBar
	android:id="@+id/line_progress"
	android:layout_marginTop="@dimen/default_margin"
	android:layout_width="50dp"
	android:layout_height="50dp" />

属性

有下面这些属性你可以设置:

The style:

  • line (默认)
  • solid_line
  • solid

The background color

  • background_color

The progress text:

  • text color
  • text size
  • visibility
  • format

The progress circle:

  • width
  • start_color
  • end_color
  • background color

The progress_shader

  • linear (默认,如果start_color和end_color相同则不会设置shader)
  • radial
  • sweep

The progress_stroke_cap

  • butt (默认)
  • round
  • square

The line style:

  • width
  • count

例如 :

代码语言:javascript
复制
<com.dinuscxj.progressbar.CircleProgressBar
	android:layout_width="50dp"
	android:layout_height="50dp"

	app:style="line"

	app:background_color="@color/holo_red_light"

	app:progress_text_color="@color/holo_purple"
	app:progress_text_size="@dimen/progress_text_size"
	app:draw_progress_text="true"
	app:progress_text_format_pattern="@string/progress_text_format_pattern"

	app:progress_stroke_width="1dp"
	app:progress_start_color="@color/holo_purple"
	app:progress_end_color="@color/holo_green_light"
	app:progress_background_color="@color/holo_darker_gray"

	app:progress_shader="sweep"

	app:progress_stroke_cap="round"

	app:line_width="4dp"
	app:line_count="30"/>

优点

  1. 继承ProgressBar, 不必关心当前进度状态的保存, ProgressBar 已经在onSaveInstanceState()和 onRestoreInstanceState(Parcelable state)
  2. 定制性很强,可以设置两种风格的进度条,设置进度条的颜色和进度文本的颜色和大小, 由于代码中对于进度文本的格化化是使用的String.format(), 所以进度文本可以根据需要随意定制
  3. 代码优雅,代码注释很全面,格式整齐,可以直接在xml中设置相关的属性。
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016-07-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • CircleSeekbar
  • quick start
  • attrs
  • ProgressView
    • CircleProgressBar
      • 用法
      • 属性
      • 优点
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档