0

I want to rotate an image only and not whole activity. So, when I apply

getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

The above line of code in a fragment rotates the image but when back to activity, fragment tabs also rotate. And when I change in manifest for portrait and landscape then whole activity rotated.

How to fix it?

Maximilien Belinga
  • 3,076
  • 2
  • 25
  • 39
Swati
  • 146
  • 1
  • 10

2 Answers2

0

You can use imageView.setRotation(angle) to change the rotation of your ImageView.

Ferdous Ahamed
  • 21,438
  • 5
  • 52
  • 61
0

Use an OrientationEventListener and rotate the image on orientation changes.

See this answer

Community
  • 1
  • 1
A. Steenbergen
  • 3,360
  • 4
  • 34
  • 51