using AndroID.App;
using AndroID.Widget;
using AndroID.OS;
using System.Collections.Generic;
using AndroID.Runtime;
namespace App12
{
[Activity(Label = "App12", MainLauncher = true)]
public class MainActivity : Activity
{
ListVIEw List_member;
SimpleAdapter content;
IList<IDictionary<string, object>> data;
protected overrIDe voID OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentVIEw(Resource.Layout.Main);
List_member = FindVIEwByID<ListVIEw>(Resource.ID.ListVIEw1);
//填充数据
FillDate();
//创建数据适配器
content = new SimpleAdapter(
this,
data,
AndroID.Resource.Layout.SimpleListItem2,
new string[] { "Title", "number" },
new int[] { AndroID.Resource.ID.Text1,AndroID.Resource.ID.Text2 });
//把数据绑定到List_member 这个ListvIEw上
List_member.Adapter = content;
}
public voID FillDate()
{
data = new List<IDictionary<string, object>>();
for (int i = 3; i < 20; i++)
{
//我这里面的数据是写死的,有数据库的同学可以连数据库
JavaDictionary<string, object> achIEvement = new JavaDictionary<string, object>();
achIEvement.Add("Title", "你好,我是张" + i);
achIEvement.Add("number","座号"+i);
data.Add(achIEvement);
}
}
}
}
以上是内存溢出为你收集整理的VS 2019开发APP(三)listview的应用全部内容,希望文章能够帮你解决VS 2019开发APP(三)listview的应用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)