G
G
GenryLettem2018-05-01 12:59:12
Mobile development
GenryLettem, 2018-05-01 12:59:12

In what screen sizes to build an application on xamarin?

For the first time I come across both Xamarin and mobile development.
I shoveled through the documentation and articles, and here's what I got:
dp == width_in_px * 160 / dpi
There is the concept of Screen Density. For example xhdpi where 1dp == 2px
I installed Xamarin Live Player. I take my iPad Air2.
I find out on google that dpi == 264px per inch. Resolution is 2048x1536px. I paste it into the formula and calculate:
width_in_dp == 2048 * 160 / 264. This equals 1241.
I set the AbsoluteLayout Label with a point of 0 0 and a width of 1241px. I get a wider element.
I find device metrics from google, they indicate Screen Density xhdpi for ipad. Taking into account the new information, I divide and get 1024dp. And it fits. https://material.io/devices/
And here is my question:
Why is the first formula wrong and how are Xamarin applications designed in terms of size? To correctly display on devices of various sizes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wcoder, 2018-07-12
@GenryLettem

The sizes you use in Xamarin.Forms are values ​​that are set for platforms to be equal to their size measurement types. For UWP it's Effective pixels, for iOS it's Points, and for Android it's Density-independent pixels.
A couple of links on this topic:
Working with sizes
Image sizes
How to find out the size in pixels on the platform, for cont...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question