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
  • 2,996
  • 2
  • 23
  • 39
Swati
  • 136
  • 1
  • 10

2 Answers2

0

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

Ferdous Ahamed
  • 20,743
  • 5
  • 48
  • 58
0

Use an OrientationEventListener and rotate the image on orientation changes.

See this answer

Community
  • 1
  • 1
A. Steenbergen
  • 3,280
  • 3
  • 32
  • 51