I have tried setting this code on MainActivity.cs
[Activity(Label = "PG_ELearning.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
}
But this locked screen rotation for all the screens. I want some screens(In which I am playing video) should have landscape mode. All screens are in Xamarin PCL shared code. I do visited these links:
http://www.appliedcodelog.com/2017/05/force-landscape-or-portrait-for-single.html
How to detect screen orientation of the device in Xamarin.Forms?
But I am not able to find the correct approach.