Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How can I get the display size, in order to position some things appropriately?

$
0
0

Based on my previous question about positioning a background image, I thought that a possible solution might be to set the width to the display size, and calculate the height of the image from that.

The problem is that I don't know how to get the actual display size. I thought I could just implement something like IDisplay and use the DependencyService, but I can't figure out how to implement the Android part, since all of the examples I've found expect to be in either a view or an activity, and use something like Context.Resources.DisplayMetrics, which however isn't available in my POCO implementation of the service.

Is there any other way to access the display metrics globally, or am I just approaching this wrong?


Viewing all articles
Browse latest Browse all 58056

Trending Articles