当前位置: 首页 > news >正文

常用网站推广方法电商微信商城小程序官网

常用网站推广方法电商,微信商城小程序官网,天津招聘网人才招聘官网,洛阳作公司网站第一次写文#xff0c;请多指教#xff0c;有何问题及改进建议都可以告诉我-.-Idea来自金山词霸App的单词计数#xff0c;下面先放图autoNumber.gif如上图#xff0c;就是#xff0c;下面开始进入自己设置View自己设置View步骤1. 自己设置属性2. 生成构造方法3. onMeasure…第一次写文请多指教有何问题及改进建议都可以告诉我-.-Idea来自金山词霸App的单词计数下面先放图autoNumber.gif如上图就是下面开始进入自己设置View自己设置View步骤1. 自己设置属性2. 生成构造方法3. onMeasure(可选)4. onSizeChanged(可选)5. onLayout(可选)6. onDraw我这里只重写了onSizeChangedonMeasure和onLayout没有重写1.自己设置属性values里面新建attrs //变化速度 //边框颜色 //数字颜色 2.生成构造方法public AutoNumberView(Context context) { super(context); } public AutoNumberView(Context context, Nullable AttributeSet attrs) { super(context, attrs); //自己设置属性 TypedArray typedArray context.obtainStyledAttributes(attrs, R.styleable.AutoNumberView); strokeColor typedArray.getColor(R.styleable.AutoNumberView_stroke_color, context.getResources().getColor(R.color.colorPrimaryDark)); autoSpeed typedArray.getInteger(R.styleable.AutoNumberView_auto_speed, 1000); textColor typedArray.getColor(R.styleable.AutoNumberView_text_color, context.getResources().getColor(R.color.black)); typedArray.recycle(); init(); initAnimation(); }初始化动画和画笔private void init() { paint new Paint(); paint.setColor(strokeColor); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(10); paint.setAntiAlias(true); textPaint new Paint(); textPaint.setColor(textColor); textPaint.setStyle(Paint.Style.STROKE); textPaint.setTextAlign(Paint.Align.CENTER); textPaint.setAntiAlias(true); } private void initAnimation() { //根据属性动画值重绘数字 valueAnimator ValueAnimator.ofFloat(0,1).setDuration(autoSpeed); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { Override public void onAnimationUpdate(ValueAnimator animation) { value (float) animation.getAnimatedValue(); invalidate(); } }); }3.onSizeChangedOverride protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); int min Math.min(w, h); //中心点XY centerX w / 2; centerY h / 2; radius (int) (min * 0.8f / 2); textPaint.setTextSize(radius / 2); //计算数字位于中心点的矩形 targetRect new Rect(-min / 2, -min / 2, min / 2, min / 2); Paint.FontMetricsInt fontMetrics textPaint.getFontMetricsInt(); //中线 baseline (targetRect.bottom targetRect.top - fontMetrics.bottom - fontMetrics.top) / 2; }4.onDrawOverride protected void onDraw(Canvas canvas) { //移动中心点 canvas.translate(centerX, centerY); //边框 canvas.drawCircle(0, 0, radius, paint); //数字 canvas.drawText(String.valueOf((int)(value * number)), targetRect.centerX(), baseline, textPaint); }5.使用方法public class MainActivity extends AppCompatActivity { ... Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); //设置数值 autoNumberView.get(0).setNumber((int) (Math.random() * 500 1000)); autoNumberView.get(1).setNumber((int) (Math.random() * 500 1000)); autoNumberView.get(2).setNumber((int) (Math.random() * 500 1000)); showLoading.setOnClickListener(new View.OnClickListener() { Override public void onClick(View v) { //启动 for (AutoNumberView auto : autoNumberView) { auto.startAnimation(); } } }); numberValue.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //设置数值 value.setText(设置值: progress * Math.random() * 1000); for (AutoNumberView auto : autoNumberView) { auto.setNumber((int) ((Math.random() * 1000) * progress)); } } }); autoSpeed.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //设置速度 speed.setText(设置速度: progress * 100); for (AutoNumberView auto : autoNumberView) { auto.setAutoSpeed(100 * progress); } } }); }}最后一律代码地址(GitHub - alaidev/AutoNumber)
http://www.zqtcl.cn/news/610373/

相关文章:

  • 微网站套餐自媒体网站源码模板dede
  • 企业网站改版升级成都便宜网站建设公司
  • 广州公共资源建设工程交易中心网站新塘做网站
  • 数码港 太原网站开发公司iis 建立子网站
  • 做一个自己的网站需要什么商标设计网站猪八戒
  • 傻瓜式网站建设软件保险预约
  • 网站 备案规定自己做简单网站
  • 网站上怎么做支付接口南乐网站建设
  • 咸阳网站建设公司电话做个公司网站大概多少钱
  • 网站如何做关键词排名点子网创意网
  • 浙江建设培训考试网站河源东莞网站建设
  • 网站移动端做pc端的301跳转哪些网站是增值网
  • wordpress新闻站浙江耀华建设集团网站
  • 网站开发代理企业网站推广技巧和方法
  • 俄语网站开发用模板做的网站多少钱
  • 丽水网站建设公司广州网络公司
  • 做基金的网站哪个好针对大学生推广引流
  • 国外对旅游网站的建设互联网推广和互联网营销
  • 海南省建设厅网站首页有什么做设计的兼职网站
  • 网站导航功能苏州市高新区建设局网站
  • jsp网站 值班多语种网站开发
  • 公司网站英文做电商
  • 合肥企业网站建设公司哪家好卖产品怎么做网站
  • 网站建设公司86215中国中小企业网站
  • 做网站 如何 挣钱游戏网站开发协议
  • 网站建设发展wordpress比较慢
  • 收费网站推广动漫制作就业方向
  • 湖北优化网站建设设计公司需要什么资质
  • 个人网站怎么制作wordpress创意小工具
  • 网站管理维护怎么做在线oa