コード例 #1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View itemView = LayoutInflater.From(_context).Inflate(Resource.Layout.MovieTile, parent, false);

            ImageView ivMovie = itemView.FindViewById <ImageView>(Resource.Id.ivMovie);
            //ViewGroup.LayoutParams llParams = ivMovie.LayoutParameters;
            //llParams.Width = (2*llParams.Height)/3
            //ivMovie.LayoutParameters = llParams;
            MovieViewHolder vh = new MovieViewHolder(itemView, OnClick);

            return(vh);
        }
コード例 #2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            try
            {
                Log.Debug("GetView", "Position=" + position);
                MovieViewHolder vh = (MovieViewHolder)holder;

                Movie movie = _movies[position];

                Log.Debug("GetView", movie.ToString());
                string          strURI    = MovieAPI.GetImageURL(movie.poster_path, 0);
                Android.Net.Uri posteruri = Android.Net.Uri.Parse(strURI);
                Picasso.With(_context).Load(posteruri).Into(vh.ivPoster, new IVCallback(position));
            }
            catch (Exception e)
            {
                Log.Debug("GetView", "Exception " + e.Message);
            }
        }