我需要获取API 10+版本下Android屏幕分辨率的代码。
我正在使用Monogame Android。
using Android.App;
_ScreenWidth = Resources.DisplayMetrics.WidthPixels;
这段代码只能在Actvity1.cs
中运行,而不能在Game1.cs
中运行,为什么?我使用了Android.App;
语句...
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
ScreenWidth = Resources.DisplayMetrics.WidthPixels;
Game1.Activity = this;
var g = new Game1();
SetContentView(g.Window);
g.Run();
}