Xamarin - The Device.Idiom property is not working in some Android devices

Viewed 330

The Device.Idiom property is used to alter layouts width depending on the device type. But the view is not visible or view width is about 0 while running my app in some device ( Redmi Note 8 Pro powered by Android 9).

It's working fine in other devices like emulators, iOS simulators etc. Below is the sample snippet I have used.

<StackLayout>
    <StackLayout.WidthRequest>
        <OnIdiom
            x:TypeArguments="x:Double"
            Phone="280"
            Tablet="300" />
    </StackLayout.WidthRequest>
</StackLayout>.   

In the above snippet, I have set the view width as 280 and 300 for Phone and Tablet respectively.

I think, I got this freaky error after the update of Xamarin.Froms to 4.6.0.772.

Working Environment

  • Visual Studio Community 2019 for Mac
  • Xamarin.Mac Version: 6.18.2.1
  • Xamarin.iOS Version: 13.18.2.1
  • Xamarin.Android Version: 10.3.1.4

Test Device Details

  • Device Model: Redmi Note 8 Pro
  • MIUI Version: MIUI 11.0.4
  • Android Version: Android 9 Pie

Any help will be really appreciated.

Thank you

0 Answers
Related