Android Development studio

Asked

Viewed 72 times

-7

What function do I use to get an animation of credits , where the letters will flow in front of the screen , in the case of bottom to top ?

1 answer

0


J Matthew. I’ll explain to you briefly the logic of how I did it. I would create a timer that 50 on 50 or 150 on 150, that would draw the text/credits decreasing the position.

The code would be something like this:

public static void main(String[] args) {
  int X,Y;

  TimerTask mudarCreditos= new TimerScheduleFixedRateDelay();
  Timer tempo = new Timer();

  tempo.scheduleAtFixedRate(tasknew,tempo para começar pode ser 0,tempo para repetir 150);      
  }
// este metodo é o que vai acontecer de 150 em 150 ms
  public void run() {
  //diminuir 20px de cada vez pode ser o Y ou ambos
  //X-=20;
  Y-=20; 
  TextView txtView = (TextView) findViewById(R.id.textView);
  txtView.setX(X);
  txtView.setY(Y);
  //Invalidate serve para redesenhar
  invalidate();
   }    

The way you’re gonna do it invalidate and the objects will depend on whether to use an XML layout or a programmable layout.

I hope I’ve helped

  • But and the text , I should put it inside a Textview even , to call it ?

  • Yes you can put it inside a Textview, in the code I already updated ;)

  • The answer was essential , thank you!.

  • I hope it was helpful to help you solve that problem. But a piece of advice next time you comment here on the forum reminds you of those tips I gave and remember to always post a code image to help us understand better. Also try to be as simple and clear as possible

  • My next comments will be simpler and clearer, I’m using stack overflow for a while,.

  • No problem ;)

  • Regarding imagemView ,how can I get the action of clicking on it and making a jump?

  • Put this in the Imageview settings android:clickable="true" and then the code imgView.setOnClickListener(new View.OnClickListener() {
 //@Override
 public void onClick(View v) {
 Log.v(TAG, " click"); 
 } 
});

  • I understood the action of (click) on the image Iew , but the image jump , how can I get this action by clicking?

  • I jump like this?

  • When you click on Imageview it goes up and then goes back down ,I am developing a game and I would need this function to continue.

  • I told you how Matthew, you do that .setY and then after a while you fade again

Show 7 more comments

Browser other questions tagged

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