Repeat android animation

后端 未结 4 1689
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 05:39
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.vitesse);

    gpsManager = new GPSManager();

         


        
4条回答
  •  粉色の甜心
    2020-12-14 06:26

    Android gives you elegant mechanisms to represent the loading process. You could use an indeterminate ProgressBar, or an ImageView with a scale/alpha animation, instead of animating the TextView itself.

    Maybe you might find this animation useful, for animating alpha and scale at the same time. Vary the parameters for your preference:

    file R.anim.alpha_scale_animation

    
    
    
    
    
    
    

    then to launch it in your code:

    Animation connectingAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.alpha_scale_animation);
    myView.startAnimation(connectingAnimation);
    

    And to stop it:

    myView.clearAnimation();
    connectingAnimation.cancel();
    connectingAnimation.reset();
    

    You can also use libraries like ProgressButtonView to have both user interaction and loading process supported in the same widget.

    Hope that any of these solutions result useful to someone :)

提交回复
热议问题