我在Xamarin的第一个应用程序看起来像空白应用程序

时间:2017-04-29 11:28:45

标签: c# android visual-studio xamarin

我在ViusalStudio中创建了空白应用程序(android)。 我只添了一个按钮。 当我部署我的应用程序并测试它时,我得到的只是app-name栏(看看空白的应用程序)。

出了什么问题?我等了很长时间没什么变化。

2 个答案:

答案 0 :(得分:0)

在主要活动中,确保取消注释代码行SetContentView,以便它使用axml文件进行布局

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        // Set our view from the "main" layout resource
        SetContentView (Resource.Layout.Main);
    }

答案 1 :(得分:0)

很难说没看到你的代码看起来如何,但可能你没有在OnCreate()中设置你的布局

SetContentView (Resource.Layout.'your_layout');
相关问题