1. 程式人生 > >Android正在載入動畫

Android正在載入動畫

LoadingImage

正在載入的ImageView

使用方法

maven
   <dependency>
    <groupId>com.hlq</groupId>
    <artifactId>loadingimageview</artifactId>
    <version>1.0.0</version>
    <type>pom</type>
  </dependency>
Gradle
  compile 'com.hlq:loadingimageview:1.0.0'

在xml中使用

   <hlq.loadingimage.LoadingImageView
       app:styleanima = "animator"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_marginTop="20dp"
      />
width和height是必須的兩個屬性, app:styleanima 可選可不選,有兩個值可以選擇

animation 和 animator 對應兩種載入效果

不設定時即預設值是animation

當為animation時,效果如圖所示:

image

大小可以自己設定,20dp左右最佳

當為animator時,效果圖如下:

image

可以看到小球的顏色再變換,當然我們也可以設定多個並排顯示,如圖所示:

image

球的大小我們也可以取設定

原始碼地址;https://github.com/huanglinqing123/LoadingImage

歡迎start和issue
歡迎關注技術公眾號,微訊號搜尋ColorfulCode 程式碼男人

分享技術文章,投稿分享,不限技術種類,不限技術深度,讓更多人因為分享而受益。