예제 #1
0
        OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            // Inflate the CardView for the photo:

            View itemView = LayoutInflater.From(Application.Context).Inflate(Resource.Layout.PhotoCardView, parent, false);

            // Create a ViewHolder to find and hold these view references, and
            // register OnClick with the view holder:
            PhotoViewHolder vh = new PhotoViewHolder(itemView, OnClick);

            return(vh);
        }
예제 #2
0
        OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            PhotoViewHolder vh = holder as PhotoViewHolder;
            //          ImageView image1;
            Bitmap bitmap;
            //         image1 = activity.FindViewById<ImageView> (Resource.Id.imV1);
            RelativeLayout relativeLayout = activity.FindViewById <RelativeLayout>(Resource.Id.relativeLayout);

            // Set the ImageView and TextView in this ViewHolder's CardView
            // from this position in the photo album:
            //     vh.Image.SetImageURI (Uri.Parse ("file:///" + mPhotoAlbum [position].Caption));
            //    vh.Image.SetImageBitmap ( BitmapFactory.DecodeFile ( mPhotoAlbum [position].Caption));

            bitmap = mPhotoAlbum[position].Caption.LoadAndResizeBitmap(MainActivity.ScreenWidth / 2, MainActivity.ScreenHeight / 2);
            // vh.Image.SetImageBitmap(mPhotoAlbum [position].Caption.LoadAndResizeBitmap (100, 100));
            //         image1.SetImageURI (Uri.Parse ("file://" + mPhotoAlbum [position].Caption));
            vh.Image.SetImageBitmap(bitmap);

            //     vh.Image.SetImageResource (mPhotoAlbum[position].PhotoID);
            //     vh.Caption.Text = mPhotoAlbum[position].Caption;
            vh.Caption.Text = mPhotoAlbum[position].PhotoID.ToString();
        }