コード例 #1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (position < 0)
                return null;

            var view = (convertView
                            ?? context.LayoutInflater.Inflate(
                                    Resource.Layout.item_monkey, parent, false)
                        );

            if (view == null)
                return null;

            var wrapper = view.Tag as MonkeyAdapterWrapper;
            if (wrapper == null)
            {
                wrapper = new MonkeyAdapterWrapper
                              {
                                  Title = view.FindViewById<TextView>(Resource.Id.item_title),
                                  Art = view.FindViewById<ImageView>(Resource.Id.item_image)
                              };
                view.Tag = wrapper;
            }

            var friend = friends.ElementAt(position);

            wrapper.Title.Text = friend.Title;
            ImageLoader.DisplayImage(friend.Image, wrapper.Art, -1);
            return view;
        }
コード例 #2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (position < 0)
            {
                return(null);
            }

            var view = (convertView
                        ?? context.LayoutInflater.Inflate(
                            Resource.Layout.item_monkey, parent, false)
                        );

            if (view == null)
            {
                return(null);
            }

            var wrapper = view.Tag as MonkeyAdapterWrapper;

            if (wrapper == null)
            {
                wrapper = new MonkeyAdapterWrapper
                {
                    Title = view.FindViewById <TextView>(Resource.Id.item_title),
                    Art   = view.FindViewById <ImageView>(Resource.Id.item_image)
                };
                view.Tag = wrapper;
            }

            var friend = friends.ElementAt(position);

            wrapper.Title.Text = friend.Title;
            ImageLoader.DisplayImage(friend.Image, wrapper.Art, -1);
            return(view);
        }