How to animate button before it is clicked

Asked

Viewed 72 times

0

Here’s an animation I’m using in my project, only it gets animation as soon as it’s clicked:

Button refresh = (Button)findViewById(R.id.refresh);
refresh.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View arg0) {
        arg0.startAnimation(rotate);

        webView.loadUrl(urlOriginal);
    }
});

I would like to put the animation as soon as it appears on the screen, ie without needing to be clicked for the animation start.

  • 1

    After obtaining the reference to the button with Button refresh = (Button)findViewById(R.id.refresh); it is possible to start the animation with refresh.startAnimation(rotate);

  • 1

    @ramaral As simple as laughing and whistling at the same time, haha! Exactly that, thank you very much friend!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.