以 xamarin 形式获取当前屏幕宽度 [英] Get current screen width in xamarin forms
本文介绍了以 xamarin 形式获取当前屏幕宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个 Xamarin Forms 项目,但我一直无法根据不同的设备查找当前屏幕宽度.
I am creating one Xamarin Forms project and I got stuck in finding the current screen width according to the different device.
我知道如何在 android 和 ios 中完成,但需要一种方法来找到可移植的宽度.
I know how it can be done in android and ios but need a way to find the width in portable.
推荐答案
你可以试试这个 Application.Current.MainPage.Width
在我的情况下这有效,我能够找到设备宽度便携式项目本身.
You can try this Application.Current.MainPage.Width
in my case this worked and i am able to find the device width in portable project itself.
这篇关于以 xamarin 形式获取当前屏幕宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文