vendredi 14 juillet 2017

rotate images in random duration in android studio

i want to make a truth or dare app.i want to rotate an image in random duration.

according to code below(i found it in Android: Rotate image in imageview by an angle) i made an animation xml and set a duration for it.

<rotate
  xmlns:android="http://ift.tt/nIICcg"
  android:fromDegrees="45"
  android:toDegrees="45"
  android:pivotX="50%"
  android:pivotY="50%"
  android:duration="0"
  android:startOffset="0"
/>

i guess i shall use a random function in main activity to get random number for random duration.

so, how shall i put this random number (which i got in main activity) in duration in animation xml?




Aucun commentaire:

Enregistrer un commentaire