无法在Android中使用Picasson加载图像

时间:2015-07-02 18:34:12

标签: android picasso

我尝试使用DrobBox或Imgur的Picasso加载图像时遇到的代码错误,但没有成功。没有错误消息,这是来自适配器。

  Picasso.with(_context)
            .load("https://dl.dropboxusercontent.com/u/15447938/attendanceapp/guest2.JPG")
            .placeholder(R.drawable.profile_icon)
            .into(holder.attendantHeadshot);

Picasso.with(_context)
                .load("http://i.imgur.com/bfU6EaG.jpg")
                .placeholder(R.drawable.profile_icon)
                .into(holder.attendantHeadshot);

RecyclerView.Adapter的完整onBindViewHolder

 @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        final Attendant selectedAttendant = mAttendantList.get(position);

        holder.attendantName.setText(selectedAttendant.getName());
        holder.attendantEmail.setText(selectedAttendant.getEmailAddress());
        Picasso.with(_context)
                .load("https://dl.dropboxusercontent.com/u/15447938/attendanceapp/guest2.JPG")
                .placeholder(R.drawable.profile_icon)
                .into(holder.attendantHeadshot);


        if (position % 2 == 0) {
            rowView.setBackgroundColor(_context.getResources().getColor(R.color.activated_color));
        }
    }

0 个答案:

没有答案