共有戦略を使用して非常に基本的なXamarin.Formsアプリケーションを構築しようとしていましたが、Androidエミュレータで表示することさえできません。Xamarin共有プロジェクトにコンテンツが表示されない
MainPage.xaml.csにメインページを設定して、それをApp.xaml.cs.のMainPage
に渡そうとしました。警告やエラーは表示されませんが、エミュレータでは空白の画面しか表示されません。誰でも私が間違っているのを見ますか?
私の他のコードはすべて、新しい共有プロジェクトを作成するときに生成される定型句のコードです。今はAndroidプロジェクトに集中しています。
App.xaml \ App.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
namespace Phoneword
{
public partial class App : Application
{
public App()
{
MainPage = new MainPage();
}
...
}
}
MainPage.xamlを\ MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
public class MainPage : ContentPage
{
public MainPage()
{
Content = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
HorizontalTextAlignment = TextAlignment.Center,
Text = "Test"
}
}
};
}
}