布局没有显示 - 而是一个空白的屏幕

时间:2013-07-14 12:27:01

标签: c# xaml mono

我是Android开发的新手,并且在显示我创建的布局时遇到了问题 - 我有一个主要活动和一个在启动时加载的布局 - 我希望在按下按钮时显示另一个布局 - 但是没有显示另一个布局,而是显示一个空白屏幕(另一个布局上有一个文本字段,所以它不应该是空白的) - 我错过了什么吗?

public class MainActivity : Activity
{
    int count = 1;

    protected override void OnCreate (Bundle bundle)

    {
        base.OnCreate (bundle);

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

        // Get our button from the layout resource,
        // and attach an event to it
        Button num1 = FindViewById<Button> (Resource.Id.num1Button);

        num1.Click += delegate {

            //button.Text = string.Format ("This is runtime text");
            SetContentView (Resource.Layout.Num1Layout);
        };
    }
}

1 个答案:

答案 0 :(得分:1)

相关问题