先看问题效果图:

那个球星水波纹是个自定义view,代码如下

import com.jinsheng.R;

import com.jinsheng.util.MyUtil;

import android.annotation.SuppressLint;

import android.content.Context;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.graphics.Canvas;

import android.graphics.Color;

import android.graphics.Paint;

import android.graphics.Paint.Style;

import android.graphics.Path;

import android.graphics.Path.Direction;

import android.graphics.Region.Op;

import android.util.AttributeSet;

import android.view.View;

import android.widget.FrameLayout;

/**

* 水波浪球形进度View

* @author caizhiming

*

*/

public class MyWaterSinkingView extends FrameLayout {

private static final int DEFAULT_TEXTCOLOT = 0xFFFFFFFF;

private static final int DEFAULT_TEXTSIZE = 50;

private float mPercent;

private Paint mPaint = new Paint();

private Bitmap mBitmap;

private Bitmap mScaledBitmap;

private float mLeft;

private int mSpeed = 7;

private int mRepeatCount = 0;

private Status mFlag = Status.NONE;

private int mTextColor = DEFAULT_TEXTCOLOT;

private int mTextSize = DEFAULT_TEXTSIZE;

@SuppressLint("NewApi")

public MyWaterSinkingView(Context context, AttributeSet attrs) {

super(context, attrs);

}

public void setTextColor(int color) {

mTextColor = color;

}

public void setTextSize(int size) {

mTextSize = size;

}

public void setPercent(float percent) {

mFlag = Status.RUNNING;

mPercent = percent;

postInvalidate();

}

public void setStatus(Status status) {

mFlag = status;

}

public void clear() {

mFlag = Status.NONE;

if (mScaledBitmap != null) {

mScaledBitmap.recycle();

mScaledBitmap = null;

}

if (mBitmap != null) {

mBitmap.recycle();

mBitmap = null;

}

}

@Override

protected void dispatchDraw(Canvas canvas) {

super.dispatchDraw(canvas);

int width = getWidth();

int height = getHeight();

//裁剪成圆区域

Path path = new Path();

canvas.save();

path.reset();

canvas.clipPath(path);

path.addCircle(width / 2, height / 2, width / 2, Direction.CCW);

canvas.clipPath(path, Op.REPLACE);

canvas.drawColor(Color.rgb(84, 139, 222));

if (mFlag == Status.RUNNING) {

if (mScaledBitmap == null) {

mBitmap = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.wave2);

mScaledBitmap = Bitmap.createScaledBitmap(mBitmap,MyUtil.dip2px(getContext(), 50)-50, getHeight(), false);

mBitmap.recycle();

mBitmap = null;

mRepeatCount = (int) Math.ceil(getWidth() / mScaledBitmap.getWidth() + 0.5) + 1;

}

for (int idx = 0; idx

//            System.out.println((idx - 1) * mScaledBitmap.getWidth());

canvas.drawBitmap(mScaledBitmap, mLeft + (idx - 1) * mScaledBitmap.getWidth(), (1-mPercent) * getHeight(), null);

}

String str = (int) (mPercent * 100) + "%";

mPaint.setColor(mTextColor);

mPaint.setTextSize(mTextSize);

mPaint.setStyle(Style.FILL);

canvas.drawText(str, (getWidth() - mPaint.measureText(str)) / 2, getHeight() / 2 + mTextSize / 2, mPaint);

mLeft += mSpeed;

if (mLeft >= mScaledBitmap.getWidth())

mLeft = 0;

// 绘制外圆玄

mPaint.setStyle(Paint.Style.STROKE);

mPaint.setStrokeWidth(4);

mPaint.setAntiAlias(true);

mPaint.setColor(Color.rgb(60, 109, 183));

canvas.drawCircle(width / 2, height / 2, width / 2 - 2, mPaint);

postInvalidateDelayed(20);

}

canvas.restore();

}

public enum Status {

RUNNING, NONE

}

}

list_item.xml

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="@color/white"

android:paddingBottom="10dp"

android:paddingLeft="10dp"

android:paddingRight="10dp"

android:layout_marginLeft="10dp"

android:layout_marginRight="10dp"

android:layout_marginBottom="10dp">

android:id="@+id/project_image"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginTop="10dp"

android:src="@drawable/cofe"/>

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginTop="10dp"

android:layout_below="@id/project_image">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:orientation="vertical">

android:id="@+id/tv_project_title"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:textColor="@color/black"

android:text="[圆梦项目] 创业咖啡厅  第一期"

android:textSize="14dp"/>

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_marginTop="5dp"

android:orientation="horizontal">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:orientation="vertical">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="出让股份"

android:textColor="@color/home_gray_text"/>

android:id="@+id/tv_sell"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center_horizontal"

android:text="20%"

android:textColor="@color/red"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerHorizontal="true"

android:orientation="vertical">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="目标金额"

android:textColor="@color/home_gray_text"/>

android:id="@+id/tv_count"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center_horizontal"

android:text="20万"

android:textColor="@color/red"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentRight="true"

android:orientation="vertical">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="投资期限"

android:textColor="@color/home_gray_text"/>

android:id="@+id/tv_time"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center_horizontal"

android:text="3个月"

android:textColor="@color/red"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentRight="true">

android:layout_width="64dp"

android:layout_height="64dp"

android:alpha="50"

android:background="@drawable/round_bg"/>

android:id="@+id/sinking"

android:layout_width="60dp"

android:layout_height="60dp"

android:layout_gravity="center"

>

求大神指教啊,生平第一次遇到这样的问题!

5 个解决方案

#1

没人回答?自己顶下

注:在vivo Xplay3S上真机运行貌似没问题  就是模拟器不行  其他真机不知道行不行

#2

有大神在吗?求解救啊!!!!!!!!!!!

#3

能把全部代码贴出来吗,部分代码。。。

#4

这个问题解决了吗??求解

#5

楼主,你的问题解决了,吗,帮忙一下吧,谢谢了

android 球形进度,android仿360手机卫士的自定义波浪球形进度View 滚动痕迹相关推荐

  1. 【android】仿360手机卫士的简易设计思路及源码

    笔者最近一直忙于满广州的跑,实习好难找好难找,博客也是有点久没去更新.仿360手机卫士的实现的目的更多的是出于对常用知识点的一个巩固吧,比较适合像我这种接触没多久的学习者在学习之余拿来练手保持写代码的 ...

  2. Android桌面悬浮窗效果实现,仿360手机卫士悬浮窗效果

    转载自:http://blog.csdn.net/guolin_blog/article/details/8689140 大家好,今天给大家带来一个仿360手机卫士悬浮窗效果的教程,在开始之前请允许我 ...

  3. 高仿360手机卫士——Android源码

    高仿360手机卫士 高仿360手机卫士界面android源码,左右滑动效果,超炫. 下载地址:http://www.devstore.cn/code/info/1173.html 运行截图:    热 ...

  4. Android实现仿360手机卫士悬浮窗效果

    大家好,今天给大家带来一个仿360手机卫士悬浮窗效果的教程,在开始之前请允许我说几句不相干的废话. 不知不觉我发现自己接触Android已有近三个年头了,期间各种的成长少不了各位高手的帮助,总是有很多 ...

  5. 高仿360手机卫士应用源码

    高仿360手机卫士界面android源码,左右滑动效果,超炫. 源码下载:http://code.662p.com/list/11_1.html <ignore_js_op> 详细说明:h ...

  6. android 360旋转动画,ANDROID——仿360手机卫士的旋转打分控件

    简介 灵感源自360手机卫,主要功能就是实现显示评分或等级的效果.并稍微改良了一下,有更好的实用性和扩展性. 因为主要用途就是显示"分数","评价",所以暂且叫 ...

  7. 仿360手机卫士首页[android平台]

    学习android几个月了,对android的UI开发部分一直不是很熟悉.于是最近拿360手机卫士首页来练手,做了个小demo,想与各位多多交流.效果图如下: (1)首页 (2)transformat ...

  8. 仿360手机卫士之查询号码归属地

    360手机卫士里基本的功能–查询来电归属地 技术要点大概如下 - 对最新号码归属地数据的压缩与解压 - sqlite3数据库的基本操作 - 监听手机来电 - 自定义Toast 准备操作 最新号码归属地 ...

  9. Android开发之仿360手机卫士悬浮窗效果

    基本的实现原理,这种桌面悬浮窗的效果很类似与Widget,但是它比Widget要灵活的多.主要是通过WindowManager这个类来实现的,调用这个类的addView方法用于添加一个悬浮窗,upda ...

最新文章

  1. ASP截取字符 截取字符之间的字符
  2. 读书笔记《单核工作法》:2
  3. C++对C的加强之新增Bool类型关键字
  4. android 获取屏幕的宽高
  5. Some projects cannot be imported because they already exist in the workspace
  6. python训练词库_在Python中训练NGramModel
  7. 小程序 background-image背景图片设置的注意点
  8. java驱动pl sql优点_用PL/SQL和Java开发Oracle8i应用程序
  9. java 泛型 t extends_Java泛型的定义以及对于? extends T和? super T
  10. SpringBoot之Bean之条件注入@ConditionalOnProperty
  11. php 开发桌面应用,使用NW将开发的网站打包成桌面应用
  12. JAVA IO中的设计模式
  13. 接口与interface关键字
  14. 算法:判断二叉树是否包含链表Linked List in Binary Tree
  15. 查看风云三号VIRR地表温度(LST)日产品属性
  16. 等保2.0详解(附3级检查表)
  17. 日文windows系统 oracle数据库乱码的处理
  18. python语言所使用的特殊含义符号_Python3 正则表达式特殊符号及用法
  19. 【保姆级讲解】C语言---指针精华
  20. VisionPro脚本Simple与Advanced

热门文章

  1. php计划任务方法(后台运行无刷新)
  2. sql server 2008安装的时候选NT AUTHORITY\NEWORK SERVICE 还是选 NT AUTHORITY\SYSTEM ?
  3. 十个提升你Emacs生产力的高招
  4. 搭建自己的企业QQ [2007年6月15日]
  5. 计算机毕业设计中用Java编写泛型与集合框架
  6. 计算机毕业设计中用Java+Html+MySQL 实现注册、登录(servlet框架)-(二
  7. php怎么写编辑页面,怎样编辑小程序页面内容?
  8. 常见鸟的种类及特点_常见乌龟的品种及图片大全!
  9. Visual C++串口通信编程---多线程异步方式
  10. Visual Assist X AutoText修改说明