Android 简单的Loading加载库(AVLoadingIndicatorView)

加载框样式图:

用法:build.gradle中引入依赖

implementation 'com.wang.avi:library:2.1.3'

布局文件:




    
        

显示与隐藏弹窗:(这里用了kotlin,java用法一样)

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.activity_main.avi
import kotlinx.android.synthetic.main.activity_main.btn_hid
import kotlinx.android.synthetic.main.activity_main.btn_show

class MainActivity : AppCompatActivity(), View.OnClickListener {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        btn_show.setOnClickListener(this)
        btn_hid.setOnClickListener(this)
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.btn_show -> {
                avi!!.show()
                avi2!!.show()
            }
            R.id.btn_hid -> {
                avi!!.hide()
                avi2!!.hide()
            }
            else -> {
            }
        }
    }

}

更换弹窗动画:如果想更换弹窗对话直接修改布局文件的indicatorName即可

 

所有动画样式名字:

Row 1

  • BallPulseIndicator
  • BallGridPulseIndicator
  • BallClipRotateIndicator
  • BallClipRotatePulseIndicator

Row 2

  • SquareSpinIndicator
  • BallClipRotateMultipleIndicator
  • BallPulseRiseIndicator
  • BallRotateIndicator

Row 3

  • CubeTransitionIndicator
  • BallZigZagIndicator
  • BallZigZagDeflectIndicator
  • BallTrianglePathIndicator

Row 4

  • BallScaleIndicator
  • LineScaleIndicator
  • LineScalePartyIndicator
  • BallScaleMultipleIndicator

Row 5

  • BallPulseSyncIndicator
  • BallBeatIndicator
  • LineScalePulseOutIndicator
  • LineScalePulseOutRapidIndicator

Row 6

  • BallScaleRippleIndicator
  • BallScaleRippleMultipleIndicator
  • BallSpinFadeLoaderIndicator
  • LineSpinFadeLoaderIndicator

Row 7

  • TriangleSkewSpinIndicator
  • PacmanIndicator
  • BallGridBeatIndicator
  • SemiCircleSpinIndicator

最后附上我自己改后的截图:

Android 简单的Loading加载库(AVLoadingIndicatorView)_第1张图片

我的项目地址:https://github.com/cuiwenju2017/KTest_01

三方Git地址:https://github.com/81813780/AVLoadingIndicatorView

你可能感兴趣的:(Android)