How to get/detect screen size in Xamarin.Forms?

前端 未结 6 824
[愿得一人]
[愿得一人] 2020-12-08 22:24

I am trying to rewrite an app that I wrote for iOS. I was going to write an android version but thought It\'d be better to make this the opportunity to use Xamarin.Forms. Do

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 22:55

    If you are using xamarin forms, then you can find width and height of current screen in portable class library(pcl) like below.

    For Width you use this in pcl,

    Application.Current.MainPage.Width
    

    For height you can do this in pcl,

    Application.Current.MainPage.Height
    

提交回复
热议问题