开始进入主题————
效果图:
创建项目-Galleryviewdemo
在Activity1下OnCreate函数添加代码 如下:
[Activity(Label = "Galleryviewdemo", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 :ListActivity
{
//int count = 1;
//声明
private Context _context;
string[] items;
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++); };
items = new string[]{
"数据1",
"数据2",
"数据3",
"数据4",
"数据5",
"数据6",
"数据7"
};
//string[] items1 = new string[]{
//"数据11",
//"数据21",
//"数据31",
//"数据41",
//"数据51",
//"数据61",
//"数据71"
//};
this.ListAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, items);
}
运行:
点击运行(或F5) 出来提示框,
点击【Start emulator image】 选择模拟器(模拟器是之前配置好的 不会配置 网上搜搜 或问我)
点击【OK】等待模拟器慢慢启动了
接着点击 OK 运行这个程序。。
第一次启动模拟器很慢的 慢慢等待。。。