- 浏览: 87806 次
- 性别:
- 来自: 北京
最新评论
-
LiuYiJie2007:
public static String getPublicK ...
Android publickey获取 -
LiuYiJie2007:
getPublicKey( )是你自己写法方法 是什么?new ...
Android publickey获取 -
liujia9234:
我试了,不行,最不靠谱了
最靠谱的禁止ViewPager滑动方法 -
kedongjun:
非常强大
关于android通讯录加载大数据的优化问题 -
xunhuan01:
view.getImageMatrix(), savedMat ...
多点触摸放大图片的自定义listener
这种效果的进度条 代码如下:
package com.netqin.antivirus.ui; import android.content.Context; import android.content.res.TypedArray; import android.graphics.*; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.util.Log; import android.widget.ImageView; import com.nqmobile.antivirus20.R; import java.util.Timer; import java.util.TimerTask; public class RoundProgressBar extends ImageView { private Paint mFramePaint; //-------------------- private Paint mRoundPaints; // 主进度条画笔 private RectF mRoundOval; // 矩形区域 private int mPaintWidth; // 画笔宽度 private int mPaintColor; // 画笔颜色 private int mBottomColor;//进度条背景色 private int mStartProgress; // 进度条起始位置 private int mCurProgress; // 主进度条当前位置 private int mMaxProgress; // 进度条最终位置 private boolean mBRoundPaintsFill; // 是否填充区域 //--------------------- private int mSidePaintInterval; // 圆环向里缩进的距离 private Paint mSecondaryPaint; // 辅助进度条画笔 private int mSecondaryCurProgress; // 辅助进度条当前位置 private Paint mBottomPaint; // 进度条背景图画笔 private boolean mBShowBottom; // 是否显示进度条背景色 //---------------------- private Handler mHandler; private boolean mBCartoom; // 是否正在作动画 private Timer mTimer; // 用于作动画的TIMER private MyTimerTask mTimerTask; // 动画任务 private int mSaveMax; // 在作动画时会临时改变MAX值,该变量用于保存值以便恢复 private int mTimerInterval; // 定时器触发间隔时间(ms) private float mCurFloatProcess; // 作动画时当前进度值 private float mProcessRInterval; // 作动画时每次增加的进度值 private final static int TIMER_ID = 0x100; // 定时器ID private long mCurTime; public RoundProgressBar(Context context) { super(context); initParam(); } public RoundProgressBar(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub initParam(); TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.RoundProgressBar); mMaxProgress = array.getInt(R.styleable.RoundProgressBar_max, 100); mSaveMax = mMaxProgress; mBRoundPaintsFill = array.getBoolean(R.styleable.RoundProgressBar_fill, true); // 获得是否是填充模式 if (mBRoundPaintsFill == false) { mRoundPaints.setStyle(Paint.Style.STROKE); mSecondaryPaint.setStyle(Paint.Style.STROKE); mBottomPaint.setStyle(Paint.Style.STROKE); } mSidePaintInterval = array.getInt(R.styleable.RoundProgressBar_inside_interval, 0);// 圆环缩进距离 mBShowBottom = array.getBoolean(R.styleable.RoundProgressBar_show_bottom, true); mPaintWidth = array.getInt(R.styleable.RoundProgressBar_paint_width, 10); if (mBRoundPaintsFill) // 填充模式则画笔长度改为0 { mPaintWidth = 0; } mRoundPaints.setStrokeWidth(mPaintWidth); mSecondaryPaint.setStrokeWidth(mPaintWidth); mBottomPaint.setStrokeWidth(mPaintWidth); mPaintColor = array.getColor(R.styleable.RoundProgressBar_paint_color, 0xffffcc00); mBottomColor = array.getColor(R.styleable.RoundProgressBar_paint_bottom_color, Color.WHITE); mRoundPaints.setColor(mPaintColor); int color = mPaintColor & 0x00ffffff | 0x66000000; mSecondaryPaint.setColor(color); array.recycle(); //一定要调用,否则会有问题 } private void initParam() { mFramePaint = new Paint(); mFramePaint.setAntiAlias(true); mFramePaint.setStyle(Paint.Style.STROKE); mFramePaint.setStrokeWidth(0); mPaintWidth = 0; mPaintColor = 0xffffcc00; mRoundPaints = new Paint(); mRoundPaints.setAntiAlias(true); mRoundPaints.setStyle(Paint.Style.FILL); mRoundPaints.setStrokeWidth(mPaintWidth); mRoundPaints.setColor(mPaintColor); mSecondaryPaint = new Paint(); mSecondaryPaint.setAntiAlias(true); mSecondaryPaint.setStyle(Paint.Style.FILL); mSecondaryPaint.setStrokeWidth(mPaintWidth); int color = mPaintColor & 0x00ffffff | 0x66000000; mSecondaryPaint.setColor(color); mBottomPaint = new Paint(); mBottomPaint.setAntiAlias(true); mBottomPaint.setStyle(Paint.Style.FILL); mBottomPaint.setStrokeWidth(mPaintWidth); mBottomPaint.setColor(mBottomColor); mStartProgress = -90; mCurProgress = 0; mMaxProgress = 100; mSaveMax = 100; mBRoundPaintsFill = true; mBShowBottom = true; mSidePaintInterval = 0; mSecondaryCurProgress = 0; mRoundOval = new RectF(0, 0, 0, 0); mTimerInterval = 25; mCurFloatProcess = 0; mProcessRInterval = 0; mBCartoom = false; mHandler = new Handler() { public void handleMessage(Message msg) { if (msg.what == TIMER_ID) { if (mBCartoom == false) { return ; } mCurFloatProcess += mProcessRInterval; setProgress((int) mCurFloatProcess); if (mCurFloatProcess > mSaveMax) { mBCartoom = false; setProgress(mSaveMax); if (mTimerTask != null) { mTimerTask.cancel(); mTimerTask = null; } } } } }; mTimer = new Timer(); } public synchronized void setProgress (int progress) { mCurProgress = progress; if (mCurProgress < 0) { mCurProgress = 0; } if (mCurProgress > mMaxProgress) { mCurProgress = mMaxProgress; } invalidate(); } public synchronized int getProgress() { return mCurProgress; } public synchronized void setSecondaryProgress (int progress) { mSecondaryCurProgress = progress; if (mSecondaryCurProgress < 0) { mSecondaryCurProgress = 0; } if (mSecondaryCurProgress > mMaxProgress) { mSecondaryCurProgress = mMaxProgress; } invalidate(); } public synchronized int getSecondaryProgress() { return mSecondaryCurProgress; } public synchronized void setMax(int max) { if (max <= 0) { return ; } mMaxProgress = max; if (mCurProgress > max) { mCurProgress = max; } if (mSecondaryCurProgress > max) { mSecondaryCurProgress = max; } mSaveMax = mMaxProgress; invalidate(); } public synchronized int getMax() { return mMaxProgress; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { // TODO Auto-generated method stub super.onSizeChanged(w, h, oldw, oldh); Log.i("", "W = " + w + ", H = " + h); if (mSidePaintInterval != 0) { mRoundOval.set(mPaintWidth/2 + mSidePaintInterval, mPaintWidth/2 + mSidePaintInterval, w - mPaintWidth/2 - mSidePaintInterval, h - mPaintWidth/2 - mSidePaintInterval); }else{ int sl = getPaddingLeft(); int sr = getPaddingRight(); int st = getPaddingTop(); int sb = getPaddingBottom(); mRoundOval.set(sl + mPaintWidth/2, st + mPaintWidth/2, w - sr - mPaintWidth/2, h - sb - mPaintWidth/2); } } public synchronized void startAnimation(int time, int progresLenght) { if (time <= 0 || mBCartoom == true) { return ; } mBCartoom = true; if (mTimerTask != null) { mTimerTask.cancel(); mTimerTask = null; } setProgress(0); setSecondaryProgress(0); mSaveMax = progresLenght; mMaxProgress = (1000 / mTimerInterval) * time; mProcessRInterval = (float)mTimerInterval * mMaxProgress / (time * 1000); mCurFloatProcess = 0; mCurTime = 0; mTimerTask = new MyTimerTask(); mTimer.schedule(mTimerTask, mTimerInterval, mTimerInterval); } public void setShaperColors(int[] colors){ if (null != colors){ LinearGradient mLinearGradient = new LinearGradient(0,0,100,100,colors,null,Shader.TileMode.REPEAT); mRoundPaints.setShader(mLinearGradient); } } public synchronized void stopAnimation() { mBCartoom = false; mMaxProgress = mSaveMax; setProgress(0); if (mTimerTask != null) { mTimerTask.cancel(); mTimerTask = null; } } public void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); if (mBShowBottom) { canvas.drawArc(mRoundOval, 0, 360, mBRoundPaintsFill, mBottomPaint); } float secondRate = (float)mSecondaryCurProgress / mMaxProgress; float secondSweep = 360 * secondRate; canvas.drawArc(mRoundOval, mStartProgress, secondSweep, mBRoundPaintsFill, mSecondaryPaint); float rate = (float)mCurProgress / mMaxProgress; float sweep = 360 * rate; canvas.drawArc(mRoundOval, mStartProgress, sweep, mBRoundPaintsFill, mRoundPaints); } class MyTimerTask extends TimerTask{ @Override public void run() { Message msg = mHandler.obtainMessage(TIMER_ID); msg.sendToTarget(); } } }
发表评论
-
Android_低版本使用ActionBar
2014-08-26 11:09 1096转载 http://blog.csdn.net/tianjf0 ... -
如何屏蔽android webview高度选中框
2014-02-19 12:04 747如标题所述,解决方法是在 html的样式中加入 *{-webk ... -
屏蔽ScrollView惯性滚动的方法
2013-08-08 13:36 5714ScrollView中有一种惯性滚动的效果,想让这个Scrol ... -
android 图片LOMO效果
2013-07-25 13:59 872import android.graphics.Bitmap; ... -
GitHub最火的android 项目
2013-07-25 13:14 779GitHub在中国的火爆程度无需多言,越来越多的开源项目迁移到 ... -
listview 点击列表项时,项中的Button会触发点击效果
2013-06-05 19:21 1284开发中,难免会在列表项中, 加入Button ,而button ... -
最靠谱的禁止ViewPager滑动方法
2013-05-15 14:44 4957最近做项目要求某种情况下ViewPager不能滑动,在网上找了 ... -
viewpager主页面响应子页面 onkeydown事件的方法
2013-05-13 19:35 1618大家在开发中不少地方要用到ViewPager这个类,ViewP ... -
Mina 学习笔记 TCP主要接口
2013-05-05 23:21 1225(1.)IoService: 这个接口 ... -
android动画插件器
2013-04-27 10:01 830首先要了解为什么需要插值器,因为在补间动画中,我们一般只定义关 ... -
imageView 的 android:maxHeight,maxWidth属性
2013-03-29 10:17 814大家使用android:maxHeight,maxWidth属 ... -
android中获取下载地址文件的类型的方法
2013-03-28 11:33 1025MimeTypeMap mimeTypeMap = Mime ... -
res与res-auto的区别
2013-03-27 14:55 3961通常我们在布局文件中使用自定义属性的时候 会这样写 xmln ... -
滑动开关控件
2013-03-26 22:39 814public class SlidButton exten ... -
TextView使用SpannableString设置复合文本
2013-03-23 23:35 8791、BackgroundColorSpan 背景色 Sp ... -
Android编程之SparseArray<E>详解
2013-03-21 23:03 984一、构造 从构造方法我 ... -
判断系统是否支持 DownloadManager服务
2013-03-18 14:25 862public static boolean isDownloa ... -
android ndk native_activity.h
2013-03-12 15:25 1767#ifndef ANDROID_NATIVE_ACTIVITY ... -
android ndk obb.h
2013-03-12 15:14 1133#ifndef ANDROID_OBB_H #define A ... -
Android NDK APIs
2013-03-12 14:53 983使用 Android NDK 的一般方法: 1、假如想要使用f ...
相关推荐
首先,让我们了解水波滚动进度条。这种进度条设计通常以波浪形图案展示进度,给人一种动态和生动的感觉。实现这一效果通常需要自定义View,并结合动画来模拟水波的滚动。开发者可能需要重写`onDraw()`方法,绘制水波...
本教程将详细讲解如何使用C#和WPF来实现一个圆形的加载进度条,同时带有百分比显示。 首先,我们需要了解WPF的基本概念。WPF是.NET Framework的一部分,它提供了一个用于构建桌面应用程序的强大框架。它使用XAML...
"水波滚动"和"圆环进度条"是两种常用于增强视觉效果和提供反馈机制的UI元素。这些元素常见于各种应用,如移动应用、网页或者桌面软件,用来展示数据加载、任务完成度等信息。 水波滚动通常指的是在界面上呈现的动态...
今天手把手教大家用CSS3制作圆形滚动进度条动画,想不会都难!那么,到底是什么东东呢?先不急,之前我分享了一个css实现进度条效果的博客《CSS实现进度条和订单进度条》,但是呢,那篇博客只是制作出来效果而已,...
本示例中,我们探讨的主题是如何创建一个自定义的圆形进度条,并且带有圆点效果。这个控件可以用于显示某个任务的完成度或者加载状态,通过调整颜色和属性,使其更加符合应用程序的视觉风格。 首先,我们需要创建一...
总结,创建一个模拟电池电量的上下滚动进度条涉及到自定义View的绘制、动画效果的实现、电池状态监听以及UI布局设计等多个环节。通过巧妙地结合这些技术,可以为用户提供更直观、动态的电量显示效果。在实际开发中,...
### JavaScript 实现圆形进度条拖拽滑动 #### 技术背景 在现代网页开发中,动态元素和交互式设计是提升用户体验的关键因素之一。其中,进度条是一种常见的UI组件,用于显示操作或任务的完成程度。传统的线性进度条...
通过`Animated.timing`函数,我们可以设置一个动画,让进度值随着时间逐渐变化,从而实现进度条的平滑滚动。 在实际代码中,可能的步骤如下: 1. 导入所需的库: ```javascript import React, { Component } ...
进度条,请勿在未经授权的情况下上传任何涉及著作权侵权的资源,除非该资源完全由您个人创作
"圆形进度条"就是一种常见的设计,它可以优雅地展示数据加载、任务执行或计时过程。本教程将深入探讨如何实现一个自定义的圆形进度条,并结合Butterknife库和自定义弹性ScrollView来增强功能。 首先,让我们讨论...
环形进度条是一种图形化的进度指示器,通常由一个闭合的圆形路径组成,其中一部分被填充以表示已完成的部分,剩余部分表示未完成。在Android中,可以使用`ProgressBar`类的子类如`Ring形ProgressDrawable`来创建;在...
7. 进度条动画效果:为了增加用户体验,还可以为进度条添加动画效果,如平滑滚动、渐变填充等。这可能需要更深入地理解易语言的绘图和动画控制命令。 8. 错误处理与调试:在编程过程中,合理地处理错误和进行调试是...
在这个"SVG+CSS3圆形倒计时滚动条动画效果"中,我们将深入探讨如何利用这两者来创建一个引人注目的交互式组件。 SVG是一种基于XML的矢量图形格式,它可以无损地缩放,而且文件体积小,适合在网页上展示复杂的图形。...
Swiper 是一个流行的JavaScript滑动插件,常用于创建轮播图、滑动导航和其它交互式的滚动效果。在这个特定的场景中,我们关注的是如何在Swiper中添加分页标签以及进度条,并且能够自定义它们的位置。下面将详细探讨...
在Android开发中,有时我们需要为应用的图标或者某些视图添加一些特殊的效果,例如右上角的角标图片、滚动数字以及圆形进度条等。这些元素可以用来展示通知数量、未读消息或者其他状态信息,增强用户界面的交互性和...
通过设置动画的时间、插值器等参数,可以使进度条的滚动更具有动态感。 6. 属性动画:在Android中,属性动画API允许开发者在不改变对象状态的情况下,模拟对象属性的变化,这在自定义控件的动画效果中非常常用。...
最近这两天一直在为大家分享一些HTML5、CSS和SVG的炫酷动画,...这次我们来介绍一款实用的jQuery进度条插件,这款jQuery进度条插件的外观利用了CSS3的特性,让进度条外观显得非常时尚漂亮,一共有10种样式,非常实用。
在开发微信小程序的时候,遇到圆形进度条的需求。使用canvas绘图比较麻烦: 1、为了实现在不同屏幕上面的适配,必须动态的计算进度条的大小; 2、在小程序中,canvas的画布具有最高的层级,不易于扩展。 但使用css3...
在本项目中,"jQuery实现鼠标滚轮控制的10多种圆形百分比进度条效果.zip",我们将探讨如何使用jQuery库来创建响应式且可自定义的圆形百分比进度条,这些进度条能够通过用户的鼠标滚轮进行交互。jQuery是一个强大的...