protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.CapabilitiesDetails); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "Описание"; SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); var position = Intent.GetIntExtra("position", -1); var capability = CapabilitiesList.Capabilities[position]; var image = FindViewById <ImageView>(Resource.Id.iconImageView); var primaryText = FindViewById <TextView>(Resource.Id.primaryTextView); var secondaryText = FindViewById <TextView>(Resource.Id.secondaryTextView); var description = FindViewById <TextView>(Resource.Id.descriptionTextView); image.SetImageDrawable(ImageAssetManager.Get(this, capability.Icon)); primaryText.Text = capability.PrimaryText; secondaryText.Text = capability.SecondaryText; description.Text = capability.Description; }
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 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(parent.Context, instructors[position].ImageUrl)); holder.Name.Text = instructors[position].Name; holder.Specialty.Text = instructors[position].Specialty; return(view); }
public override View GetView(int position, View convertView, ViewGroup parent) { View view = convertView; ImageView photo = null; TextView name = null, speciality = null; //TODO - 2 view reuse /*view = context.LayoutInflater.Inflate (Resource.Layout.InstructorRow, parent, false); * * photo = view.FindViewById<ImageView> (Resource.Id.photoImageView); * name = view.FindViewById<TextView> (Resource.Id.nameTextView); * speciality = view.FindViewById<TextView> (Resource.Id.specialtyTextView); */ if (view == null) { view = context.LayoutInflater.Inflate(Resource.Layout.InstructorRow, parent, false); } if (view.Tag == null) { photo = view.FindViewById <ImageView> (Resource.Id.photoImageView); name = view.FindViewById <TextView> (Resource.Id.nameTextView); speciality = view.FindViewById <TextView> (Resource.Id.specialtyTextView); view.Tag = new ViewHolder { Name = name, Photo = photo, Specialty = speciality }; } else { photo = ((ViewHolder)view.Tag).Photo; name = ((ViewHolder)view.Tag).Name; speciality = ((ViewHolder)view.Tag).Specialty; } Drawable drawable = ImageAssetManager.Get(context, instructors [position].ImageUrl); photo.SetImageDrawable(drawable); name.Text = instructors [position].Name; speciality.Text = instructors [position].Specialty; return(view); }