aresshinnok
aresshinnok

Reputation: 51

Android: Orientation on fragments?

I have a menu with fragments instead of activities. Each fragment is full screen when is called. I want to be able to make for fragment1 - orientation portrait, fragment 2 - orientation landscape etc.. For activities is easy beacuse i can change them in the manifest, but how can i do on fragments?

Upvotes: 1

Views: 445

Answers (1)

Blackbelt
Blackbelt

Reputation: 157447

Inside the onCreate of each fragment you have to call

getActivity().setRequestedOrientation(requestedOrientation)

that's will set the orientation of your Activity (se the Fragment orientation) to requestedOrientation. This is the only way. Fragment itself can not manage its orientation

Upvotes: 2

Related Questions