0

I am about to leave a project and wanted to add a little Easter egg to the app. I was just wondering, is it possible to rotate the whole screen 360 degrees on a button click say? Or is this too hard?

I was potentially thinking you could take a screenshot, rotate that screenshot 360 degrees, and then delete it. But I'm not sure about the security implications of taking a screenshot the users phone

James King
  • 2,425
  • 7
  • 30
  • 45
  • 1
    Check answer there: http://stackoverflow.com/questions/4359390/android-animate-rotate – Android Android Jun 09 '15 at 14:03
  • So we do use this for a progress bar, but I was wondering if we were able to rotate the screen, which would mean the activity and/or fragments. So it could be anywhere in the app and essentially, grab the screen you are on, rotate it 360 degrees and allow the user to continue their journey – James King Jun 09 '15 at 14:07

1 Answers1

2

You could specify an id in your root layout (e.g @+id/main) and use a classic animation like this

    final RotateAnimation rotateAnimation = new RotateAnimation(0.0f, 360.0f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setDuration(500);
    findViewById(R.id.main).startAnimation(rotateAnimation);
Médéric
  • 938
  • 4
  • 12