以Xamarin形式获取当前屏幕宽度 [英] Get current screen width in xamarin forms

查看:351
本文介绍了以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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆