小编Tes*_*est的帖子

C#Xamarin Android的响应式布局如何?

我在Xamarin制作一个Android应用程序.我想让它响应,所以我需要获得屏幕大小值(这是有效的).现在我需要将此发送到另一个活动,但我无法获得该值,因为我首先需要打开资源布局.

string width1 = Intent.GetStringExtra("width") ?? "Data not available";
width = width1.ToString();
string height2 = Intent.GetStringExtra("height") ?? "Data not available";
height = height2.ToString();

// Set our view from the "recepten" layout resource
if (Convert.ToInt32(width) <= 350 && Convert.ToInt32(height) <= 420)
{
SetContentView(Resource.Layout.login);
}
else
{
SetContentView(Resource.Layout.loginSmall);
}
Run Code Online (Sandbox Code Playgroud)

我试过这个(不工作),但是当另一个布局已经打开时,我无法获得另一个布局.

有谁知道怎么样?

c# android responsive-design xamarin

0
推荐指数
1
解决办法
2430
查看次数

标签 统计

android ×1

c# ×1

responsive-design ×1

xamarin ×1