示例#1
0
        public static List <ClassImage> GetSubjectsImage()
        {
            string imgConfFilePath = System.IO.Path.Combine(DATA_PATH, "images.conf");

            if (!File.Exists(imgConfFilePath))
            {
                File.WriteAllText(imgConfFilePath, IMAGES_DEFAULT);
            }
            string imgConfig = File.ReadAllText(imgConfFilePath);

            string[]          vs     = imgConfig.Split('\n');
            List <ClassImage> images = new List <ClassImage>();

            foreach (var i in vs)
            {
                if (i.Trim() == "")
                {
                    continue;
                }
                string[]   vss = i.Split(' ');
                ClassImage ci  = new ClassImage();
                ci.DisplayName = vss[0];
                ci.Name        = vss[1];
                images.Add(ci);
            }
            return(images);
        }
示例#2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ClassImage ct = classes[position];
            View       view;

            if (convertView == null)
            {
                view = LayoutInflater.From(con).Inflate(Resource.Layout.list_item_image, null);
            }
            else
            {
                view = convertView;//直接对convertView进行重用
            }
            ImageView classImg  = view.FindViewById <ImageView>(Resource.Id.SubjectImage);
            TextView  className = view.FindViewById <TextView>(Resource.Id.SubjectName);

            classImg.SetImageResource(DataController.GetClassImage(ct.DisplayName));
            className.Text = ct.DisplayName;

            //fill in your items
            //holder.Title.Text = "new text here";

            return(view);
        }