Forum Xamarin Xamarin.Forms

Detect if Phone vs Tablet (iPhone vs iPad, Android Phone vs Android Tablet)


For phone vs tablet i want to use different layouts since on a Tablet you do have more space available.
How can I detect if a device is a Phone vs a Tablet? This is for both iOS and Android.



  • @JMarcus The Device class tells my samsung galaxy tab 2 as phone if i start the app in landscape mode. Any views on that.

  • loletmalupetloletmalupet USMember ✭✭

    Add the Xamarin.Essentials nuget package to your project. Then use this code:

    var idiom = DeviceInfo.Idiom;

    For more info, read it here

  • JohnHardmanJohnHardman GBUniversity admin

    This is an old thread that has been re-awoken.

    IMHO, Device.Idiom and DeviceInfo.Idiom are normally not what should be used. If an app requires functionality provided by the hardware or o/s, it should ideally test whether that functionality is available on the current device, rather than assume that testing Idiom is equivalent to testing for functionality. Even if it's just a case of is there enough screen space available for a particular layout, it's better to test for the space required rather than use Idiom (although in most cases, it's possible to build a responsive UI without testing having a high-level test on space required).

Sign In or Register to comment.