.NET MAUI always gives the original orientation even after changing the orientation on the Android emulator

535 Views Asked by At

This is kind of silly, but

private void OnButtonClicked(object sender, EventArgs e)
{
    Shell.Current.DisplayAlert("Orientaion", DeviceDisplay.Current.MainDisplayInfo.Orientation.ToString(), "OK");
}

always gives "portrait" (with a phone emulator) or "landscape" (with a tablet emulator) even after I switch the orientation. It just gives the default orientation even after the emulator successfully changes it.

What am I missing?

1

There are 1 best solutions below

0
Jessie Zhang -MSFT On BEST ANSWER

You can recheck if you have enabled option Auto-rotate on your Android device.

Swipe down on your phone's screen, and then you will find the Auto-rotate option.

Enter image description here