布局没有出现,而是一个空白屏幕
本文关键字:一个 屏幕 空白 布局 | 更新日期: 2023-09-27 18:22:11
我是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);
};
}
}
看看http://docs.xamarin.com/guides/android/getting_started/hello%2C_multi-screen_applications。我想这可能对你有帮助。