コード例 #1
0
        public override Android.Views.View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
        {
            var view = convertView;

            if (view == null)
            {
                var inflater = LayoutInflater.From(parent.Context);
                view = inflater.Inflate(Resource.Layout.InstructorRow, parent, false);
                var vh = new ViewHolder();

                vh.Photo     = view.FindViewById <ImageView> (Resource.Id.photoImageView);
                vh.Name      = view.FindViewById <TextView> (Resource.Id.nameTextView);
                vh.Specialty = view.FindViewById <TextView> (Resource.Id.specialtyTextView);

                view.Tag = vh;
            }

            var viewHolder = (ViewHolder)view.Tag;

            var instructor = instructors [position];

//			Stream stream = parent.Context.Assets.Open (instructor.ImageUrl);
//			Drawable drawable = Drawable.CreateFromStream (stream, null);
            Drawable drawable = ImageAssetManager.Get(parent.Context, instructor.ImageUrl);

            viewHolder.Photo.SetImageDrawable(drawable);

            viewHolder.Name.Text      = instructor.Name;
            viewHolder.Specialty.Text = instructor.Specialty;

            return(view);
        }
コード例 #2
0
        public override View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
        {
            var view = convertView;

            if (view == null)
            {
                view = context.LayoutInflater.Inflate(Resource.Layout.InstructorRow, parent, false);

                var p = view.FindViewById <ImageView>(Resource.Id.photoImageView);
                var n = view.FindViewById <TextView>(Resource.Id.nameTextView);
                var s = view.FindViewById <TextView>(Resource.Id.specialtyTextView);

                view.Tag = new ViewHolder()
                {
                    Photo = p, Name = n, Specialty = s
                };
            }

            var holder = (ViewHolder)view.Tag;

            holder.Photo.SetImageDrawable(ImageAssetManager.Get(context, instructors[position].ImageUrl));
            holder.Name.Text      = instructors[position].Name;
            holder.Specialty.Text = instructors[position].Specialty;

            return(view);
        }
コード例 #3
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var view = convertView;

            if (view == null)
            {
                view = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.InstructorRow, parent, false);


                var photo     = view.FindViewById <ImageView>(Resource.Id.photoImageView);
                var name      = view.FindViewById <TextView>(Resource.Id.nameTextView);
                var specialty = view.FindViewById <TextView>(Resource.Id.specialtyTextView);
                photo.SetImageDrawable(ImageAssetManager.Get(Application.Context, _instructors[position].ImageUrl));
                name.Text      = _instructors[position].Name;
                specialty.Text = _instructors[position].Specialty;
                view.Tag       = new ViewHolder()
                {
                    Photo = photo, Name = name, Specialty = specialty
                };
            }

            var holder = (ViewHolder)view.Tag;

            holder.Photo.SetImageDrawable(ImageAssetManager.Get(parent.Context, _instructors[position].ImageUrl));
            holder.Name.Text      = _instructors[position].Name;
            holder.Specialty.Text = _instructors[position].Specialty;

            return(view);
        }
コード例 #4
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var view = convertView;

            if (view == null)
            {
                var inflater = LayoutInflater.From(parent.Context);
                view = inflater.Inflate(Resource.Layout.InstructorRow, parent, false);

                view.Tag = new ViewHolder()
                {
                    Photo     = view.FindViewById <ImageView>(Resource.Id.photoImageView),
                    Name      = view.FindViewById <TextView>(Resource.Id.nameTextView),
                    Specialty = view.FindViewById <TextView>(Resource.Id.specialtyTextView)
                };
            }

            var holder = (ViewHolder)view.Tag;

            Stream stream = parent.Context.Assets.Open(instructors[position].ImageUrl);

            holder.Photo.SetImageDrawable(ImageAssetManager.Get(parent.Context, instructors[position].ImageUrl));

            holder.Name.Text      = instructors[position].Name;
            holder.Specialty.Text = instructors[position].Specialty;

            return(view);
        }
コード例 #5
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var view = convertView;

            if (view == null)
            {
                view = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ChatRow, parent, false);

                var p = view.FindViewById <ImageView>(Resource.Id.photoImageView);
                var n = view.FindViewById <TextView>(Resource.Id.nameTextView);
                var c = view.FindViewById <TextView>(Resource.Id.contentTextView);

                view.Tag = new ViewHolder()
                {
                    Photo = p, Name = n, Content = c
                };
            }

            var holder = (ViewHolder)view.Tag;

            holder.Photo.SetImageDrawable(ImageAssetManager.Get(parent.Context, chats[position].ImageUrl));
            holder.Name.Text    = chats[position].Name;
            holder.Content.Text = chats[position].Content;

            return(view);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.InstructorDetails);

            var position   = Intent.GetIntExtra("position", -1);
            var instructor = InstructorData.Instructors[position];

            var photo     = FindViewById <ImageView>(Resource.Id.photoImageView);
            var name      = FindViewById <TextView>(Resource.Id.nameTextView);
            var specialty = FindViewById <TextView>(Resource.Id.specialtyTextView);
            var biography = FindViewById <TextView>(Resource.Id.biographyTextView);

            photo.SetImageDrawable(ImageAssetManager.Get(this, instructor.ImageUrl));
            name.Text      = instructor.Name;
            specialty.Text = instructor.Specialty;
            biography.Text = instructor.Biography;
        }