Android Orientation ActivityGroup Screen Orientation

I have a serious problem and cannot find answers to questions on the Internet. In my application, I have an action group that contains four actions. The activity that extends activity group i does not contain a fragment of the screen orientation code,

setRequestedOrientation(1); And in the other three acts I mentioned this as a portrait. And all actions work fine in portrait mode. But I need one action to change the orientation when the device rotates. I did not specify the setRequestedOrientation (1) code for this action. But this activity does not change depending on the rotation of the device.

Has anyone encountered such an error. Any help would be greatly appreciated. Thank you in advance.

+4
source share
3 answers

As you said, you have an ActivityGroup and it contains 4 actions, you set Portrait mode for all types of activities, except for one.

Now I am sure that its execution is due to the fact that your ActivityGroup has the "Portrait" setting in the AndroidManifest file, if you delete it, then your entire ActivityGroup will work as in orientation. If you save it as “Portrait” or “Landscape”, your sub-actions (ie, “Views”) will be in the same orientation as your ActivityGroup .

0
source

In the Android manifest file, go to the "Application" tab, in which select your activity file. You see the attributes on the right side. In doing so, you have the option of screen orientation. There you can set the desired orientation.

+2
source

The above answer is correct. just add this to your AndroidManifest.xml file in your

 android:screenOrientation="portrait" 

for actions to be performed in portrait mode.

for landscape just specify how

 android:screenOrientation="landscape" 

if you have not indicated that the application will work both in landscape and portrait modes.

0
source

All Articles