网站制作用什么语言搜狐新闻手机网

pingmian/2025/10/11 15:13:54/文章来源:
网站制作用什么语言,搜狐新闻手机网,外包做网站,杭州公司注销网站备案效果图#xff1a;demo效果演示演示Demo特性与原生Progress相比#xff0c;感觉更漂亮一点#xff0c;可以显示进度值#xff0c;背景凹凸感明显#xff0c;进度条效果更加立体。原理说明额#xff0c;挺简单的。不过感觉我的做法有点复杂了#xff0c;我先自定义了一个…效果图demo效果演示演示Demo特性与原生Progress相比感觉更漂亮一点可以显示进度值背景凹凸感明显进度条效果更加立体。原理说明额挺简单的。不过感觉我的做法有点复杂了我先自定义了一个View专门作为进度条的显示图层,如下所示将其布局在高度不超过20dp的ColorfulProgressBar父布局中设置Y方向的偏移量然后动画循环改变Y坐标实现斜条滚动的动画效果当你调用setProgress方法时则改变其在父布局的X坐标实现进度显示的功能进度文字同样原理添加到了父布局中。项目地址相关代码ColorfulProgressbar.javapackage com.capton.colorfulprogressbar;import android.content.Context;import android.content.res.TypedArray;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.util.AttributeSet;import android.util.Log;import android.view.Gravity;import android.view.ViewGroup;import android.view.animation.LinearInterpolator;import android.view.animation.TranslateAnimation;import android.widget.TextView;/*** Created by capton on 2017/8/10.*/public class ColorfulProgressbar extends ViewGroup {public static final String STYLE_NORMALnormal; //正常单色样式public static final String STYLE_COLORFULcolorful; //双色样式public String stylecolorful;private ColorfulView colofulView; //双色Viewprivate TextView progressView; // 第二进度条private TextView maskView; // 季度条白色渐变图层private TextView percentView; //文字显示进度层private Paint progressPaintnew Paint(); //颜色一画笔private Paint progressPaint2new Paint(); //颜色二画笔private Paint backgroundPaintnew Paint(); //背景画笔private int maxHeight; //ColorfulProgressbar高度最大值private int mHeight; //ColorfulProgressbar高度private int mWidth; //ColorfulProgressbar宽度private long progress; //进度值private long secondProgress; //第二进度值private long maxProgress100; //默然最大进度100private int backgroundColorgetResources().getColor(R.color.progressBg); //背景颜色private int secondProgressColorgetResources().getColor(R.color.secondProgressColor); //第二进度条颜色private int progressColorgetResources().getColor(R.color.colorAccent); //进度条颜色一private int progressColor2getResources().getColor(R.color.ltcolorAccent); //进度条颜色二private int percentColorColor.DKGRAY; //进度文字的颜色默认暗灰色private int percentShadeColorColor.WHITE; //进度文字的阴影颜色默认白色private TranslateAnimation translateAnimation; //双色进度条的动画private boolean animationOntrue; //动画开启的标志位private boolean animationCancle; //动画取消的标志位private boolean showPercenttrue; // 是否显示进度文字的标志位private boolean setBackgroudColor; // 是否改变背景颜色的标志位public ColorfulProgressbar(Context context) {this(context,null);}public ColorfulProgressbar(Context context, AttributeSet attrs) {this(context, attrs,0);}public ColorfulProgressbar(Context context, AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);setWillNotDraw(false); //自定义ViewGroup默认不调用onDraw方法而这里有很多步骤需要在ondraw中操作所以调用setWillNotDraw(false)mHeightDisplayUtil.dip2px(context,4); //默认进度条高度为4dpgetParameter(context,attrs);}/*** 从xml中获取各个属性* param context* param attrs*/private void getParameter(Context context, AttributeSet attrs){if(attrs!null) {TypedArray ta context.obtainStyledAttributes(attrs, R.styleable.ColorfulProgressbar);style ta.getString(R.styleable.ColorfulProgressbar_style);if (!STYLE_NORMAL.equals(style) !STYLE_COLORFUL.equals(style)) {style STYLE_COLORFUL; //如果没有在xml中显示设置style默认使用双色进度条}progress ta.getInteger(R.styleable.ColorfulProgressbar_progress, (int)progress);secondProgress ta.getInteger(R.styleable.ColorfulProgressbar_secondProgress,(int)secondProgress);maxProgress ta.getInteger(R.styleable.ColorfulProgressbar_max, (int) maxProgress);backgroundColor ta.getColor(R.styleable.ColorfulProgressbar_backgroundColor, backgroundColor);progressColor ta.getColor(R.styleable.ColorfulProgressbar_progressColor1, progressColor);progressColor2 ta.getColor(R.styleable.ColorfulProgressbar_progressColor2, progressColor2);ta.recycle();partition2 (float)this.progress/maxProgress; //进度条百分比partition (float)this.secondProgress/maxProgress; //第二进度条百分比}}Overrideprotected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {super.onMeasure(widthMeasureSpec, heightMeasureSpec);int widthSizeMeasureSpec.getSize(widthMeasureSpec);int widthModeMeasureSpec.getMode(widthMeasureSpec);int heightSizeMeasureSpec.getSize(heightMeasureSpec);int heightModeMeasureSpec.getMode(heightMeasureSpec);widthSizewidthModeMeasureSpec.EXACTLY?widthSize:DisplayUtil.dip2px(getContext(),200);heightSizeheightModeMeasureSpec.EXACTLY?heightSize:DisplayUtil.dip2px(getContext(),4);/** 当你设置高度大于20dp时强制高度变为20dp,太高了不美观。* */maxHeightDisplayUtil.dip2px(getContext(),20);if(mHeightmaxHeight) {mHeight maxHeight;}/** 设置高度* */if(mHeight0){heightSizemHeight;}/** 在高度小于10dp时强制不能使用文字显示进度因为高度实在是太小了在这个高度下字体看不清楚放在进度条外又不美观只好折中设计了。* */if(mHeightshowPercentfalse;}/** 设置宽度* */if(mWidth0){widthSizemWidth;}setMeasuredDimension(widthSize,heightSize); //确定主视图宽高}boolean once;Overrideprotected void onLayout(boolean changed, int l, int t, int r, int b) {if(!once) {progressPaint.setColor(progressColor);progressPaint2.setColor(progressColor2);progressPaint.setAntiAlias(true);progressPaint2.setAntiAlias(true);progressView new TextView(getContext());progressView.setWidth(getMeasuredWidth());progressView.setHeight(getMeasuredHeight());progressView.setBackgroundColor(secondProgressColor);switch (style) {case STYLE_COLORFUL:colofulView new ColorfulView(getContext(), getMeasuredWidth(), progressPaint, progressPaint2);break;case STYLE_NORMAL:colofulView new ColorfulView(getContext(), getMeasuredWidth(), progressPaint, progressPaint);break;}percentView new TextView(getContext());percentView.setText((int)((float)partition2*100)%);percentView.setTextSize(DisplayUtil.px2sp(getContext(), (float) (getMeasuredHeight()*0.8)));percentView.setGravity(Gravity.CENTER);percentView.setShadowLayer(2,1,2,percentShadeColor);percentView.setTextColor(percentColor);percentView.measure(0,0);int textWidth percentView.getMeasuredHeight()*2;int textHeight percentView.getMeasuredHeight();maskView new TextView(getContext());maskView.setWidth(getMeasuredWidth());maskView.setHeight(getMeasuredHeight() * 2 / 3);maskView.setBackgroundResource(R.drawable.progress_mask);/** 依次添加第二进度条双色进度条(第一进度条)白色渐变层百分比文字显示层等四个子View* */addView(progressView);addView(colofulView);addView(maskView);addView(percentView);getChildAt(0).layout(0, 0, getMeasuredWidth(), getMeasuredHeight()); //布局第二进度条位置int ChildHeight getMeasuredWidth();getChildAt(1).layout(0, -ChildHeight getMeasuredHeight(), getMeasuredWidth(), getMeasuredWidth()); //布局双色进度条/** 根据标识位为双色进度条设置位移动画(无限向上移动视觉上达到斜条向右移动的效果)* */if (animationOn) {translateAnimation new TranslateAnimation(0, 0, 0, ChildHeight - getMeasuredHeight());translateAnimation.setDuration((long) (8000 * (float) getMeasuredWidth() / DisplayUtil.getScreenWidthPx(getContext())));translateAnimation.setRepeatCount(-1);translateAnimation.setInterpolator(new LinearInterpolator());getChildAt(1).setAnimation(translateAnimation);translateAnimation.start();}getChildAt(2).layout(0, 0, getMeasuredWidth(), getMeasuredHeight() * 2 / 3); //布局白色渐变层getChildAt(3).layout(0, 0, textWidth,textHeight); //布局百分比文字显示层/** 根据标志位确定是否显示百分比文字显示层。* */if(showPercent){getChildAt(3).setVisibility(VISIBLE);}else {getChildAt(3).setVisibility(GONE);}/** 设置默认背景图你当然也可以使用纯色的资源。这里我用了一个黑色透明渐变的背景呈现一个由阴影效果的凹槽* */setBackgroundResource(R.drawable.background);oncetrue;}}public void showPercentText(boolean showPercent){this.showPercentshowPercent;}public int getSecondProgressColor() {return secondProgressColor;}public void setSecondProgressColor(int secondProgressColor) {this.secondProgressColor secondProgressColor;}public void setSecondProgressColorRes(int secondProgressColorRes) {this.secondProgressColor getResources().getColor(secondProgressColorRes);}public int getPercentColor() {return percentColor;}public void setPercentColorRes(int percentColorRes) {this.percentColor getResources().getColor(percentColorRes);}public int getPercentShadeColor() {return percentShadeColor;}public void setPercentShadeColor(int percentShadeColor) {this.percentShadeColor percentShadeColor;}public void setPercentShadeColorRes(int percentShadeColorRes) {this.percentShadeColor getResources().getColor(percentShadeColorRes);}public String getStyle() {return style;}public void setStyle(String style) {this.style style;}public int getProgressColor() {return progressColor;}public void setProgressColor(int progressColor) {this.progressColor progressColor;}public void setProgressColorRes(int progressColorRes) {this.progressColor getResources().getColor(progressColorRes);}public int getProgressColor2() {return progressColor2;}public void setProgressColor2(int progressColor2) {this.progressColor2 progressColor2;}public void setProgressColor2Res(int progressColor2Res) {this.progressColor2 getResources().getColor(progressColor2Res);}public void setAnimation(boolean animationOn){this.animationOnanimationOn;}public long getSecondProgress() {return secondProgress;}private float partition;public void setSecondProgress(long secondProgress) {this.secondProgress secondProgress;partition (float)this.secondProgress/maxProgress;}public int getBackgroundColor() {return backgroundColor;}public void setBackgroundColor(int backgroundColor) {this.backgroundColor backgroundColor;setBackgroudColortrue;}public void setBackgroundColorRes(int backgroundColorRes) {this.backgroundColor getResources().getColor(backgroundColorRes);setBackgroudColortrue;}public void setHeight(int height){mHeightheight;}public void setWidth(int width){mWidthwidth;}public void setMaxProgress(long progress){maxProgressprogress;}public long getMaxProgress(){return maxProgress;}private float partition2;public void setProgress(long progress){this.progressprogress;partition2 (float)this.progress/maxProgress;}public long getProgress(){return this.progress;}Overrideprotected void onDraw(Canvas canvas) {super.onDraw(canvas);if (getChildAt(0) ! null) {int moveX getMeasuredWidth() - (int) (partition * getMeasuredWidth());getChildAt(0).setX(-moveX);}if (getChildAt(1) ! null) {int moveX getMeasuredWidth() - (int) (partition2 * getMeasuredWidth());getChildAt(1).setX(-moveX);}if (getChildAt(2) ! null) {int moveX getMeasuredWidth() - (int) (partition2 * getMeasuredWidth());getChildAt(2).setX(-moveX);}if (getChildAt(3) ! null) {if(getChildAt(1).getX()getMeasuredWidth()getChildAt(3).getMeasuredHeight()*2) {getChildAt(3).setX(getChildAt(1).getX()getMeasuredWidth()-getChildAt(3).getMeasuredHeight()*2);}percentView.setText((int) ((float) partition2 * 100) %);/** 根据标志位确定是否显示百分比文字显示层。* */if(showPercent){getChildAt(3).setVisibility(VISIBLE);}else {getChildAt(3).setVisibility(GONE);}}if (!animationOn) {if (translateAnimation ! null) {translateAnimation.cancel();animationCancle true;}} else {if (animationCancle) {Log.w(onDraw, translateAnimation animationCancle);translateAnimation.reset();getChildAt(1).setAnimation(translateAnimation);translateAnimation.startNow();animationCancle false;}}if(setBackgroudColor) {backgroundPaint.setAntiAlias(true);backgroundPaint.setColor(backgroundColor);canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), backgroundPaint);}}}也是挺简单的欢迎大家来踩呀

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/88567.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

官方网站下载手电筒抖音关键词排名系统

因为是基础就不怎么做解释了,当然简单的题也不能忽视,它们稍微改改就又是一个新代码,当然如果有不懂的也可以询问留言!!! 下面我直接给出代码: 1.打印出一个10 * 10的“*”号矩阵 row, colum…

运城门户网站建设建设公共网站的目的

文章目录 一、SpringBoot 整合 Redis1.1 整合 Redis 步骤1.1.1 添加依赖1.1.2 yml 配置文件1.1.3 Config 配置文件1.1.4 使用示例 1.2 RedisTemplate 概述1.2.1 RedisTemplate 简介1.2.2 RedisTemplate 功能 二、RedisTemplate API2.1 RedisTemplate 公共 API2.2 String 类型 A…

购物网站建设需求模板开发网站需要哪些技术

线程安全主要分为两个方面,分别是资源访问互斥与线程同步(线程协同配合) 本篇博客,我们主要来讲解资源访问互斥这一方面 目录 为什么要实现资源访问互斥? 实现资源访问互斥(原子访问)的经典…

广州网站设计出名 乐云践新北京建设网官方网站

可到我的github上下载文件 需求: 刚加载时鼠标不移动,眼睛会不停地眨眼眼球会跟随鼠标移动而移动鼠标不移动时恢复眨眼效果提示: 除了眼睛是动态以外,其他静态绘制都在static()函数中利用椭圆的短轴长度先变短后恢复长度来模拟…

可以免费建设网站吗一天一元网站建设

大部分人基本上都会使用JS实现页面的滚动贴合效果&#xff0c;在学习的过程中&#xff0c;偶然发现原生CSS实现滚动贴合效果的方法&#xff1b; html 代码 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><tit…

wordpress静态设置北京seo的排名优化

问题描述 什么是拓扑序列 若一个由图中所有点构成的序列 A 满足&#xff1a;对于图中的每条边 (x,y)&#xff0c;x 在 A 中都出现在 y 之前&#xff0c;则称 A 是该图的一个拓扑序列。图中不能有环图中至少存在一个点的入度为0 如何求拓扑序列&#xff1f; 计算出每个节点的…

做资源下载网站好吗开发手机端网站模板下载不了

HPV感染是常见的生殖道病毒感染&#xff0c;它可能导致宫颈癌等严重疾病。对于HPV感染者来说&#xff0c;转阴是预防和治疗的关键。北京劲松HPV诊疗中心主任谭巍认为除了接受正规的治疗和注意生活方式的调整外&#xff0c;饮食也是促进HPV快速转阴的重要方面。 一、苹果 苹果…

网站建设自己可以转app的网站怎么做的

看了还是懵逼&#xff01;攻击者是在哪儿截获盐值哈希密码的&#xff1f; 文章目录 盐值处理&#xff1a;深度解析与应用1. 盐值处理简介1.1 定义与概述1.2 为什么需要盐值 2. 盐值处理工作原理2.1 创建盐值2.2 应用盐值2.3 存储盐值和哈希密码 3. 盐值处理的优点与缺点3.1 优点…

网站访问量大怎么办免费的网站模板有哪些

序列生成器是一个非常经典的协程应用场景,尤其是在需要惰性生成数据或处理潜在无限的数据流时。 序列生成器概念&#xff1a;序列生成器允许程序按需生成序列中的下一个元素&#xff0c;而不是一次性计算整个序列。这种方式可以节省内存&#xff0c;并允许处理无限或未知长度的…

免费制作永久个人网站安徽网站建设合肥网站建设

文章目录 前言一、适配器模式概述1.定义与目的2.使用场景系统升级与集成接口不一致问题的解决兼容旧版本API多种数据源处理 二、适配器模式的结构1.主要组件适配器&#xff08;Adapter&#xff09;目标接口&#xff08;Target Interface&#xff09;被适配者&#xff08;Adapte…

网站推广哪个好wordpress默认用户名密码破解

本文收录于《Scratch等级认证CCF-GESP图形化真题解析》专栏,专栏总目录:点这里,订阅后可阅读专栏内所有文章。 一、单选题(共 10 题,每题 2 分,共 30 分) 第1题 小杨父母带他到某培训机构给他报名参加 CCF 组织的 GESP 认证考试的第 1 级,那他可以选择的认证语言有几…

如何建设部网站查职称网站美观界面

代码基于yolov5 v6.0 目录&#xff1a; yolo源码注释1——文件结构yolo源码注释2——数据集配置文件yolo源码注释3——模型配置文件yolo源码注释4——yolo-py datasets # 用于存放数据集的默认文件夹yolov5 data # 模型训练的超参数配置文件以及数据集配置文件 hyps # 存放超参…

塘厦 网站建设 百度推广手机网站怎么备案

转自 https://www.csdn.net/article/2015-07-30/2825340 简介&#xff1a; Docker通过namespace将容器与主机上的网络和运行环境进行了隔离&#xff0c;默认情况下&#xff0c;在容器中运行带界面的软件在外部是看不到的。在这个分享中&#xff0c;将介绍通过共享X11套接字让外…

本人做静态网站开发网站session 验证

所谓的js页面跳转就是利用javesrcipt对打开的页面ULR进行跳转&#xff0c;如我们打开的是A页面&#xff0c;通过javsrcipt脚本就会跳转到B页面。目前很多垃圾站经常用js跳转将正常页面跳转到广告页面&#xff0c;当然也有一些网站为了追求吸引人的视觉效果&#xff0c;把一些栏…

中国施工总承包100强seo快排软件

使用 Chrome Timeline 来优化页面性能有时候&#xff0c;我们就是会不由自主地写出一些低效的代码&#xff0c;严重影响页面运行的效率。或者我们接手的项目中&#xff0c;前人写出来的代码千奇百怪&#xff0c;比如为了一个 Canvas 特效需要同时绘制 600 个三角形&#xff0c;…

重庆高端网站设计自建网站公司

在ADS中&#xff0c;信号上升时间为信号从0&#xff5e;100&#xff05;所用的时间&#xff0c;而实际上定义的上升边均为10&#xff05;&#xff5e;90&#xff05;&#xff0c;所以可以认为上升边&#xff1d;0.8*ADS设置上升时间。 一、终端开路及短路的反射信号 1.仿真条…

网站建设报价单初期整理代理游戏

目录&#xff1a; 目录 1 JSP基础知识架构 1 指令标识 1 Page命令 2 Including指令 3 taglib指令 2 脚本标识 1 JSP表达式 2 声明标识 3 代码片段 3 JSP注释 1 HTML注释 2 带有JSP表达式的注释 3 隐藏注释 4 动态注释 4 动作标识 1 包含文件标识 2 请求转发标…

wap网站制作哪家好wordpress 自动发货

我的新书《Android App开发入门与实战》已于2020年8月由人民邮电出版社出版&#xff0c;欢迎购买。点击进入详情 对于谷歌和安卓来说&#xff0c;这是一个重要时刻。谷歌刚刚发布了 Gemini 1.0&#xff0c;这是其最新的LLM&#xff0c;它采用了 OpenAI 的 GPT4。 共有三种不同…

检测站营销方案石家庄新闻主持人

在实际开发中&#xff0c;我们经常会遇到下载文件的需求&#xff0c;一般情况下接口最好的处理方式为上传到文件对象存储服务器&#xff0c;然后给前端返回一个下载文件的URL&#xff0c;前端直接打开链接下载就可以了&#xff0c;但…在下载数据量大且参数复杂的情况下&#x…

服务器不是自己的做违法网站2345浏览器网页版入口

引言 PWM&#xff08;脉冲宽度调制&#xff09;是一种常见的模拟控制方式&#xff0c;通过调节脉冲宽度来控制功率输出的占空比&#xff0c;从而实现模拟信号的传输和控制。在许多领域中&#xff0c;PWM都得到了广泛的应用&#xff0c;如电机控制、LED调光、音频控制等。本文将…