zoukankan      html  css  js  c++  java
  • Android开发UI之动画侦听

    动画侦听使用了AnimationListener接口,需要实现三个方法onAnimationStart()、onAnimationRepeat()、onAnimationEnd()

    代码:

    实现Button的动画侦听

     1         findViewById(R.id.btnAnimation).setOnClickListener(new OnClickListener() {
     2             
     3             @Override
     4             public void onClick(View v) {
     5                 // TODO Auto-generated method stub
     6                 Animation a=AnimationUtils.loadAnimation(getApplicationContext(), R.anim.anim);
     7                 a.setAnimationListener(new AnimationListener() {
     8                     
     9                     @Override
    10                     public void onAnimationStart(Animation animation) {
    11                         // TODO Auto-generated method stub
    12                         
    13                     }
    14                     
    15                     @Override
    16                     public void onAnimationRepeat(Animation animation) {
    17                         // TODO Auto-generated method stub
    18                         
    19                     }
    20                     
    21                     @Override
    22                     public void onAnimationEnd(Animation animation) {
    23                         // TODO Auto-generated method stub
    24                         Toast.makeText(getApplicationContext(), "Animation End", Toast.LENGTH_SHORT).show();
    25                     }
    26                 });
    27                 v.startAnimation(a);
    28             }
    29         });
  • 相关阅读:
    2020暑假牛客多校9 B
    2020暑假牛客多校10 C -Decrement on the Tree (边权转点权处理)
    HDU 5876 补图的最短路
    CSP初赛复习
    遗传算法
    排列组合
    和式 sigma的使用
    多项式的各种操作
    三分
    NOIP2018普及游记
  • 原文地址:https://www.cnblogs.com/liyiran/p/4651181.html
Copyright © 2011-2022 走看看