【问题标题】:Error:(59, 17) error: cannot find symbol method crossFade()错误:(59, 17) 错误: 找不到符号方法 crossFade()
【发布时间】:2018-03-18 11:17:18
【问题描述】:

您好,我遇到了一个错误,请告诉我为什么会出现错误

C:\Users\gupta\AndroidStudioProjects\Globlus\app\src\main\java\vg\globlus\network\adapter\GalleryListAdapter.java 错误:(59, 17) 错误:找不到符号方法crossFade()

error meassge getting here my code

    public ImageView thumbnail;

    public MyViewHolder(View view) {

        super(view);
        thumbnail = (ImageView) view.findViewById(R.id.thumbnail);
    }
}


public GalleryListAdapter(Context context, List<Image> images) {

    mContext = context;
    this.images = images;
}

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

    View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.gallery_thumbnail, parent, false);

    return new MyViewHolder(itemView);
}

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {

    Image image = images.get(position);

    Glide.with(mContext).load(image.getImgUrl())
            .thumbnail(0.5f)
            .crossFade()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(holder.thumbnail);
}

【问题讨论】:

标签: java


【解决方案1】:

使用这个

compile 'com.github.bumptech.glide:glide:3.7.0'     

如果您使用的是 4.x 版本的 glide,请执行类似的操作

GlideApp  
    .with(context)
    .load(UsageExampleListViewAdapter.eatFoodyImages[0])
    .placeholder(R.mipmap.ic_launcher) // can also be a drawable
    .error(R.mipmap.future_studio_launcher) // will be displayed if the image cannot be loaded
    .transition(DrawableTransitionOptions.withCrossFade())
    .into(imageViewCombined);

【讨论】:

  • 我正在使用滑翔:4.6.1
  • 尝试使用 compile 'com.github.bumptech.glide:glide:3.7.0 ' 而不是 4.6.1。
  • @UnboxRew 标记答案正确并投票以促进社会发展。
猜你喜欢
  • 2019-05-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多