I am trying to set one particular fragment orientation as Landscape mode. I have added setRetainInstance(true);
in onCreate method.
I have added getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
in onCreateView method.
It is working fine with 7.1 and lesser versions. But it is not working with 8.1.
I have also tried the following links. Link1 Link2 and many other solutions. But those solutions were applicable for activity. In my case, I am using a fragment. Could anyone help me to solve this issue?
I have the following code in my manifest.
<activity
android:name=".activity.HomeScreen.view.HomeActivity"
android:label="@string/title_activity_home"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />