1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > Android编程简单实现雷达扫描效果

Android编程简单实现雷达扫描效果

时间:2023-03-09 01:15:08

相关推荐

Android编程简单实现雷达扫描效果

Java|java教程

Android 扫描

Java-java教程

支付宝手机交易源码,vscode右键打开文件,ubuntu创建目录,tomcat日志怎么看,sqlite锁定,网页设计完成之后怎么放在官网,mysql数据库手动备份,正确配置apache wap服务器,js加载动画插件,前端写页面用什么框架好看,环形爬虫,php代码编辑器,二级域名seo,springboot事物失效,帝国cms灵动标签调用图片,网站打包安装 win,网页模板哪里找,模板设计,后台模板框架,jsp页面高度自适应,进入网站后台管理系统,pb程序设计 下载lzw

在eoe看到有一篇关于雷达扫描的文章,然后看了下,很简单,但是觉得还有很多可以优化的地方,下面贴出来

php表单自定义源码,ubuntu18.10安装,爬虫抢多个商品,charts 4 php,长沙baidu seolzw

package com.example.wave;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Matrix;import android.graphics.Paint;import android.graphics.Paint.Style;import android.graphics.Shader;import android.graphics.SweepGradient;import android.util.AttributeSet;import android.widget.FrameLayout;public class RadarView extends FrameLayout { private int viewSize = 500; private Paint mPaintLine; private Paint mPaintSector; private boolean isStart = false; private ScanThread mThread; private int start = 0; private final int paintWidth = 10; public RadarView(Context context) { super(context); init(); } public RadarView(Context context, AttributeSet attrs) { super(context, attrs); init(); } private void init() { initPaint(); mThread = new ScanThread(); setBackgroundColor(Color.TRANSPARENT); } private void initPaint() { mPaintLine = new Paint(); mPaintLine.setStrokeWidth(paintWidth); mPaintLine.setAntiAlias(true); mPaintLine.setStyle(Style.STROKE); mPaintLine.setColor(0xffff0000); mPaintSector = new Paint(); mPaintSector.setColor(0x9D00ff00); mPaintSector.setAntiAlias(true); } public void setViewSize(int size) { this.viewSize = size; mShader = new SweepGradient(viewSize >> 1, viewSize >> 1, Color.TRANSPARENT, Color.GREEN); setMeasuredDimension(viewSize, viewSize); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(viewSize, viewSize); } public void start() { mThread.start(); isStart = true; } public void stop() { if (isStart) { Thread.interrupted(); isStart = false; } } private Shader mShader = new SweepGradient(viewSize >> 1, viewSize >> 1, Color.TRANSPARENT, Color.GREEN); private Matrix matrix = new Matrix(); @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); int halfRadaSize = viewSize >> 1; canvas.drawCircle(halfRadaSize, halfRadaSize, halfRadaSize >> 1, mPaintLine); canvas.drawCircle(halfRadaSize, halfRadaSize, halfRadaSize - (paintWidth >> 1), mPaintLine); canvas.drawLine(halfRadaSize, 0, halfRadaSize, viewSize, mPaintLine); canvas.drawLine(0, halfRadaSize, viewSize, halfRadaSize, mPaintLine); mPaintSector.setShader(mShader); canvas.concat(matrix); canvas.drawCircle(halfRadaSize, halfRadaSize, halfRadaSize - paintWidth, mPaintSector); } protected class ScanThread extends Thread { int halfRadaSize = viewSize >> 1; @Override public void run() { while (isStart) { start = start + 2; matrix.reset(); matrix.postRotate(start, halfRadaSize, halfRadaSize); postInvalidate(); try {Thread.sleep(10); } catch (InterruptedException e) {e.printStackTrace(); } } } }}

ssm管理系统源码下载,vscode忽略css,ubuntu idle,tomcat支持umask,sqlite添加主键外键,微信公众号 如何 购买插件,目前最流行的前端组态框架,墙上褐色小爬虫有害吗,php smarty使用,河南seo优化标题,vs 网站模版,dreamweaver网页模板下载,织梦使用模板视频教程lzw

更多Android编程简单实现雷达扫描效果相关文章请关注PHP中文网!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。