安装的Visual Studio 2010 MonoDroid包括五个步骤:
具体安装可以去官方网站上看看。
新建一个monodroid的工程:
写一段测试代码:
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace MonoDroidApplication1
{
[Activity(Label = "My Activity", MainLauncher = true)]
public class Activity1 : Activity
{
int count = 1;
public Activity1(IntPtr handle)
: base(handle)
{
}
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 button = FindViewById<Button>(Resource.id.myButton);
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
}
}
运行,运行需要在android的手机上安装monodroid框架
运行helloworld,在android的上的效果
效果还不错吧!