总结下开发中常用的几类自定义加载旋转框

1.贴图,看看第一种加载旋转框

  • 在ios开发中,都会经常看到类似的加载旋转框,而android的加载旋转框就各式各样

    实现:

    • 1.创建res/anim/rotate_loading.xml文件

          <?xml version="1.0" encoding="utf-8"?><set android:shareInterpolator="false"xmlns:android="http://schemas.android.com/apk/res/android"><rotateandroid:interpolator="@android:anim/linear_interpolator"android:pivotX="50%"        android:pivotY="50%"android:fromDegrees="0"android:toDegrees="+360"android:duration="1100"android:startOffset="-1"            //设置动画执行之前的时间android:repeatMode="restart"android:repeatCount="-1" />         //设置动画重复执行的次数</set>
      
    • 2.在xml布局敲如下代码

          <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context="com.hy.progress.MainActivity" ><ImageViewandroid:id="@+id/progress_bar"android:layout_width="wrap_content"android:layout_height="wrap_content"android:scaleType="center"android:layout_centerInParent="true"android:src="@drawable/progress_icon"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="8dip"android:layout_below="@id/progress_bar"android:layout_centerInParent="true"android:text="相册初始化中..."android:textColor="#666666"android:textSize="16sp" /></RelativeLayout>
      
    • 3.在代码中敲如下代码

      ImageView ivProgress = (ImageView) findViewById(R.id.progress_bar);
      Animation loadAnimation = AnimationUtils.loadAnimation(this,R.anim.rotate_loading);
      ivProgress.startAnimation(loadAnimation);

综上,就完成了第一种加载旋转框

2.贴图,看看第二种加载旋转框

  • 有人说这种加载旋转框挺丑的,不管丑不丑,你能实现了再来评论丑不丑

    实现:

    • 1.创建res/anim/rotate_loading.xml文件

      <?xml version="1.0" encoding="utf-8"?><rotate xmlns:android="http://schemas.android.com/apk/res/android"android:pivotX="50%" android:pivotY="50%"android:fromDegrees="0"android:toDegrees="360"><shapeandroid:shape="ring"android:innerRadiusRatio="3"android:thicknessRatio="8"android:useLevel="false"><gradientandroid:type="sweep"android:useLevel="false"android:startColor="#f4e10d"android:centerColor="#ff6b21"android:centerY="0.50"android:endColor="#00bf8f" />    </shape></rotate>
      
    • 2.在xml布局敲如下代码

      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context="com.hy.progress.MainActivity" ><ProgressBarandroid:id="@+id/loading_two"android:layout_width="60dp"android:layout_height="60dp"android:indeterminateDrawable="@anim/loading_two"android:layout_centerInParent="true"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="8dip"android:layout_below="@id/loading_two"android:layout_centerInParent="true"android:text="晴天初始化中..."android:textColor="#666666"android:textSize="16sp" /></RelativeLayout>
      

综上,就完成了第二种加载旋转框

3.贴图,看看第三种加载旋转框

  • 黑白交替的旋转框,自我感觉跟白色背景混搭不怎么好看!

    实现:

    • 1.创建res/anim/rotate_loading.xml文件

          <?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android" ><item><rotateandroid:fromDegrees="0"android:toDegrees="360"android:pivotX="50%"android:pivotY="50%"android:drawable="@drawable/yh_spinner_big_inner"/></item><item><rotateandroid:fromDegrees="360"android:toDegrees="0"android:pivotX="50%"android:pivotY="50%"android:drawable="@drawable/yh_spinner_big_outer"/></item></layer-list>
      
    • 2.在xml布局敲如下代码

          <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:background="#55000000"tools:context="com.hy.progress.MainActivity" ><ProgressBarandroid:id="@+id/loading_two"android:layout_width="80dp"android:layout_height="80dp"android:indeterminateDrawable="@drawable/rotate_three"android:layout_centerInParent="true"/><TextViewandroid:layout_below="@id/loading_two"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:layout_centerInParent="true"android:text="美女初始化中..."android:textColor="#ff0000"android:textSize="18sp" /></RelativeLayout>
      

综上,就完成了第三种加载旋转框

——坚持养成整理资料的习惯——-资料整理中——-

android自定义加载旋转框相关推荐

  1. Android 自定义加载Dialog 运行效果流畅

    如何实现Android 自定义加载Dialog,而且运行效果流畅.用ProgreBar效果不是很好. 下面介绍一种用ImageView+动画  实现. 1.在.xml中加入控件: <ImageV ...

  2. Android 自定义加载动画LoadingView

    前言 本文参考辉哥的博客属性动画 - 58同城数据加载动画,用来学习属性动画相关知识非常合适. 最终效果 整体思路 绘制部分分析: 整体加载动画由三部分组成: 1.上方的正方形.圆形以及三角形,需要进 ...

  3. android 自定义加载动画效果,Android自定义View实现loading动画加载效果

    项目开发中对Loading的处理是比较常见的,安卓系统提供的不太美观,引入第三发又太麻烦,这时候自己定义View来实现这个效果,并且进行封装抽取给项目提供统一的loading样式是最好的解决方式了. ...

  4. IOS开发UI篇之──自定义加载等待框(MBProgressHUD)

    这里介绍一下网友开源的MBProgressHUD类,实现等待框, 一.网上下载  MBProgessHUD 类文件,直接导入到工程即可 二.示例分析 在我的工程中示例如下: 1)在ShowImageV ...

  5. android 自定义加载动画效果,Android 自定义View修炼-自定义加载进度动画LoadingImageView...

    一.概述 本自定义View,是加载进度动画的自定义View,继承于ImageView来实现,主要实现蒙层加载进度的加载进度效果. 支持水平左右加载和垂直上下加载四个方向,同时也支持自定义蒙层进度颜色. ...

  6. 自定义加载等待框(MBProgressHUD)

    一.网上下载  MBProgessHUD 类文件,直接导入到工程即可 二.示例分析 在我的工程中示例如下: 1)在ShowImageViewController.h头文件代码如下: #import & ...

  7. android 自定义图片加载动画效果,Android自定义加载动画-感染体

    Android自定义动画系列七,今天来分享第七个自定义Loading动画(InfectionBallBuilder),看上去感觉有种病毒源被感染的感觉,所以名字就叫感染体,这个动画做出来的效果,我不怎 ...

  8. android组件什么时候加载到r文件,Android自定义加载loading view动画组件

    我写写使用步骤 自定义view(CircleProgress )的代码 package com.hysmarthotel.view; import com.hysmarthotel.roomcontr ...

  9. android刷新时的圆形动画_Android自定义加载圈动画效果

    本文实例为大家分享了Android自定义加载圈动画展示的具体代码,供大家参考,具体内容如下 实现如下效果: 该效果图主要有3个动画: 1.旋转动画 2.聚合动画 3.扩散动画 以上3个动画都是通过Va ...

  10. Android为网络请求自定义加载动画

    android自带的加载动画都不怎么好看,在这里介绍一种自定义加载动画的方法 原始图片: 编写动画progressbar.xml, <?xml version="1.0" e ...

最新文章

  1. 9月推荐 | 从近1000篇Python文章中精选Top10
  2. cmder默认的命令提示符λ改成$
  3. eclipse从数据库逆向生成Hibernate实体类
  4. nginx配置技巧汇总
  5. UidGenerator
  6. 2018创投圈风云再起,企服征途百家争鸣,寻找中国创业最强音!
  7. 牛客 contest893 H-Chat (dp)
  8. 用CSS3来代替JS实现交互
  9. 【JavaWeb】数据库基础复习
  10. 使用 js 设置组合快捷键,支持多个组合键定义,还支持 React
  11. [20170220更新]移动多媒体时代,简书产品该如何演化
  12. 修改完out不更新_CyclicBarrier 不就是比 CountDownLatch 多了个回环么?
  13. Visual Studio(VS2017/VS2019) C++ 配置 CPLEX 教程
  14. 学计算机cpu重要还是显卡重要,电脑玩游戏CPU重要还是显卡更重要?
  15. 单层感知器与线性神经网络
  16. 为什么很多成功的企业家都有工程师背景?
  17. 电脑开机启动选择系统
  18. 邓应海:3.24最新黄金走势分析,黄金多空操作建议
  19. 勤哲EXCEL服务器财务进销存系统
  20. python怎么解压rar文件_用Python解压缩rar、zip文件的方法

热门文章

  1. 如何有效管理项目进度?管控关键里程碑?
  2. Intelij的IDEA启动报错!parent directory is read-only or the user lacks necessary permissions
  3. JavaScript详细版
  4. 一年级同音字心田花开汇总资料(附拼音)
  5. php本地解密,PHPDecode 在线解密工具
  6. 单播、广播、组播的区别和特点
  7. 软件人员kpi制定模板_KPI绩效考核软件有哪些?拥有多种考核模板i人事
  8. 为防止程序员猝死,这家公司想出了一个好办法
  9. 搭建STM32的开发环境
  10. uva 10246 - Asterix and Obelix(最短路)