2013-05-10 7 views

risposta

9

Si sta andando a voler file XML di layout del vostro vista come si vorrebbe per mostrare nella sua fase finale . Quindi imposta la visibilità su andato. Quindi si creerà un TranslateAnimation

TranslateAnimation anim = new TranslateAnimation(-100f, 0f, 0f, 0f); // might need to review the docs 
anim.setDuration(1000); // set how long you want the animation 

ViewYouWantToAnimate.setAnimation(anim); 
ViewYouWantToAnimate.setVisibility(View.VISIBLE); 
+0

Ok, ci proverò questo lunedì grazie per il suggerimento. Spero che funzioni e faccia quello che mi serve. – Shubham

+0

Grazie mille Sta funzionando Grazie mille :-) ho fatto questo e il suo lavoro – Shubham

+1

public void onClick (Vedi arg0) { \t \t \t \t se (== tasto 0) { \t \t \t \t \t key = 1 ; \t \t \t \t \t TranslateAnimation anim = new TranslateAnimation (-1250f, 0f, 0f, 0f); \t \t \t \t \t anim.setDuration (2500); \t \t \t \t \t TranslateAnimation anim1 = new TranslateAnimation (-1250f, 0f, 0f, 0f); \t \t \t \t \t anim1.setDuration (2500); \t \t \t \t \t popup.setAnimazione (animazione); \t \t \t \t \t btn.setAnimation (anim1); \t \t \t \t \t popup.setVisibility (View.VISIBLE); \t \t \t \t \t btn.setBackgroundResource (R.drawable.previousnew); \t \t \t \t} – Shubham

0

È possibile utilizzare il metodo setDuration() dell'oggetto animanion per regolare la velocità di spostamento. He're è excample dal mio codice (è scala non si muove l'animazione, ma spero che aiuta):

Animation an2 = new ScaleAnimation(TARGET_SCALE, targetXscale, TARGET_SCALE, targetYscale); 
an2.setDuration(SECOND_ANIM_LENGTH); 
+0

forse animazione TranslateAnimation – Blackbelt

+0

TranslateAnimation = new TranslateAnimation (tipo, 0, tipo, targetXdelta, tipo, 0, tipo, targetYdelta); animation.setDuration (SECOND_ANIM_LENGTH); –

+1

In realtà voglio qualcosa come un clic sul layout del pulsante dovrebbe venire da sinistra a schermo di copertura e poi di nuovo facendo clic sul pulsante che dovrebbe entrare. – Shubham

Problemi correlati