搜索
查看
编辑修改
首页
UNITY
NODEJS
PYTHON
AI
GIT
PHP
GO
CEF3
JAVA
HTML
CSS
搜索
花生_TL007
这个屌丝很懒,什么也没留下!
关注作者
热门标签
jquery
HTML
CSS
PHP
ASP
PYTHON
GO
AI
C
C++
C#
PHOTOSHOP
UNITY
iOS
android
vue
xml
爬虫
SEO
LINUX
WINDOWS
JAVA
MFC
CEF3
CAD
NODEJS
GIT
Pyppeteer
article
热门文章
1
Spring boot 入门教程-AOP详细介绍及使用_springboot aop
2
动态修改hosts_动态修改host工具
3
RROR: Package ‘ohos-build‘ requires a different Python: 3.6.9 not in ‘>=3.7‘_error: package 'ohos-build' requires a different p
4
Web菜鸟入门教程 - Springboot接入认证授权模块
5
Java客户端实现RabbitMQ简单队列_rabbitmq jdk1.7
6
【程序猿包邮送书:第四期】《分布式统一大数据虚拟文件系统——Alluxio原理、技术与实践》_分布式统一大数据虚拟文件系统 alluxio pdf
7
武器级工具包 Immunity Canvas 7.26安装初探
8
ADB常用命令大全_adb命令
9
【Unity】自定义[Attribute]特性标记_unity attribute.getcustomattributes(type);
10
电子学会C/C++编程等级考试2024年03月(四级)真题解析_中国电子学会c++四级
当前位置:
article
> 正文
扇形百分比控件_微信小程序,扇形控件
作者:花生_TL007 | 2024-05-07 14:37:49
赞
踩
微信小程序,扇形控件
根据自己需求可以在添加一些属性方法,供外界调用。比如环的颜色,字体的大小。
public class fanImageView extends View {
int centerX, centerY;
Paint mPaint;
int radius;
int gap;
int sweepAngle;
public fanImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setTextSize(20);
mPaint.setColor(Color.BLUE);
gap=10;
sweepAngle=30;
}
public fanImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public fanImageView(Context context) {
this(context, null);
}
public void setGap(int gap) {
this.gap = gap;
invalidate();
}
public void setSweepAngle(int sweepAngle) {
this.sweepAngle = sweepAngle;
invalidate();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// TODO Auto-generated method stub
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int w = MeasureSpec.getSize(widthMeasureSpec);
int h = MeasureSpec.getSize(heightMeasureSpec);
radius = Math.min(w, h) / 2;
centerX = radius;
centerY = radius;
setMeasuredDimension(radius*2, radius*2);
// measure(radius,radius);
}
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
mPaint.setColor(Color.BLUE);
canvas.drawCircle(centerX, centerY, radius, mPaint);
mPaint.setColor(Color.WHITE);
canvas.drawCircle(centerX, centerY, radius - gap, mPaint);
mPaint.setColor(Color.YELLOW);
canvas.drawArc(new RectF(0, 0, radius*2, radius*2), 0, sweepAngle, true, mPaint);
mPaint.setColor(Color.WHITE);
canvas.drawArc(new RectF(gap, gap, radius*2 - gap, radius*2 - gap), 0, sweepAngle,
true, mPaint);
mPaint.setColor(Color.BLACK);
String text=(sweepAngle*100/360)+"%";
Rect rect=new Rect();
mPaint.getTextBounds(text, 0,text.length(), rect);
int x=(radius*2-rect.width())/2;
int y=(radius*2-rect.height())/2+rect.height();
canvas.drawText(text, x, y, mPaint);
}
}
声明:
本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:
https://www.wpsshop.cn/w/花生_TL007/article/detail/549721
推荐阅读
article
C# 如何调用
webApi
接口
_
c#
调用
webapi
接口
...
安装成功,就看到就看看自己引用中是否存在Newtonsoft.Json,没有就手动添加到引用中吧。优先封装HttpCli...
赞
踩
article
2022
氯化
工艺
考试
试题及答案_
氯气
外溢
,
遇有急性
中毒者
,
应立即
让其避至上风向
空气
新鲜处。...
题库来源:安全生产模拟
考试
一点通公众号小程序2022
氯化
工艺
试题是
氯化
工艺
判断题上机
考试
练习题!2022
氯化
工艺
考试
试题...
赞
踩
article
flink
java
并行度
_
Apache
Flink
1.3-SNAPSHOT 中文文档: 并行执...
Application DevelopmentManaging Execution
并行执行
并行执行
本节描述了如何在Fli...
赞
踩
article
a
论文
写作
免费
网站
推荐!
a
i
论文
写作
免费
网站
有哪些...
AIP
a
perP
a
ss是AI原创
论文
写作
平台,
免费
千字大纲,5分钟生成3万字初稿,提供答辩汇报ppt、开题报告、任务书等...
赞
踩
article
【基于
react
的
立体
柱状图
的
实现】_
react
立体
柱状图
...
基于
react
的
立体
柱状图
的
实现_
react
立体
柱状图
react
立体
柱状图
基于
react
实...
赞
踩
article
数据结构
相关...
数据结构
——后续还会补充,用Java实现!!
数据结构
相关 数据结...
赞
踩
article
TransE
代码
实践(很详细)
_
transe
在
代码
中
的
体现...
TranE是一篇Bordes等人2013年发表在NIPS上
的
文章提出
的
算法。它
的
提出,是为了解决多关系数据(multi-...
赞
踩
article
数据结构
实验之
链
表
五:单
链
表
的
拆分
_
数据结构
实验之
链
表
五:单
链
表
的
拆分
...
数据结构
实验之
链
表
五:单
链
表
的
拆分
Description输入N个整数顺序建立一个单
链
表
,将该单
链
表
拆分
成两个子
链
表
,第一...
赞
踩
article
Web
会话
管理
安全
问题_
会话
安全
有哪些措施...
Web
会话
管理
的
安全
问题是
Web
应用中最重要的问题之一,对用户的影响很大。
会话
管理
凭证通常只是一个session ID,...
赞
踩
article
Android
蓝牙
开发
(
一
),两年
Android
开发
经验...
看到这篇文章的人不知道有多少是和我
一
样的
Android
程序员。35岁,这是我们这个行业普遍的失业高发阶段,这种情况下如果...
赞
踩
article
微信
小
程序
学习实录
4
(
开发
前准备、认证必备资料、
公众
号
关联
小
程序
、
小
程序
发布、
开发
配置
、
服务器
域名
、...
在发布
小
程序
之后,
小
程序
管理平台会提供对应的
小
程序
码的预览和下载,
开发
者可以自行下载用于线上和线下的
小
程序
服务推广。(
小
...
赞
踩
article
物
联网
平台:网络
调试
助手+
HTTP
+上传数据到
onenet
_
http
调试
助手...
中移坤灵 - 中国移动物
联网
开放平台 (10086.cn)_
http
调试
助手
http
调试
助手 目...
赞
踩
article
flutter
实战(
01
)
windows
桌面版
修改
应用
logo
、名称、显示位置、显示大小_代码
修改
...
只需要在
flutter
项目/
windows
/runner/resources目录下替换原来的应用图标 app_icon....
赞
踩
article
3
分钟
快速
实现
:9种经典
排序
算法
的
可视化
...
作者 | 爱笑
的
眼睛 来源 | 恋习Python(ID:sldata2017)最近在某网站上看到一个视频,是关于
排序
算法
...
赞
踩
article
【
Docker
】
Windows11
操作系统
下安装、使用
Docker
保姆级教程_
win11
docke...
【
Docker
】
Windows11
操作系统
下安装、使用
Docker
保姆级教程一文搞懂什么是
Docker
?分析容器的工作...
赞
踩
article
DAY
_OF_
MONTH
,
DAY
_OF_
YEAR
,
DATE
的区别...
cal.add(Calendar.
DATE
,1); System.out.println("Calendar.
DATE
,...
赞
踩
article
react
hooks
用法1:使用
useContext
和
useReducer
实现类似于Redux的状...
react
的class类组件中,使用Reducer可以进行全局的
状态
管理,但是Reducer文件本身过于臃肿,逻辑解构比...
赞
踩
article
【
JavaScript
】第六章 其它-
日期
、
Math
_
javascript
学习手册十二
:
math
、日...
获取2017-06-10格式的
日期
获取随机数,要求是长度一致的字符串格式写一个能遍历对象和数组的通用forEach函数日...
赞
踩
article
C语言上机练习及答案(北航复试练习)(一)_从
键盘输入
三个
整
数
,
分别存入
x
,
y
,
z
三个
整型变量中
,
计...
第一次作业----
计算
平均值(以下所有练习环境均是VC6++)1.问题描述:从
键盘输入
三个
整
数
,分别存入想
x
,
y
,
z
三个
...
赞
踩
article
天梯赛 L2-
3
龙龙
送
外卖
...
L2-
3
龙龙
送
外卖
(25 分)
龙龙
是“饱了呀”
外卖
软件的注册骑手,负责
送
帕特小区的
外卖
。帕特小区的构造非常特别,都是...
赞
踩
相关标签
c#
json
javascript
sqlite
flink java 并行度
人工智能
自然语言处理
深度学习
AI写作
计算机视觉
react
less
数据结构
开发语言
java
TransE
安全
web安全
php
http
服务器
android
微信小程序
小程序