Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议在ImageWatcher.show()的时候,多加一个构造函数 #8

Open
wz1509 opened this issue Jun 15, 2018 · 0 comments
Open

建议在ImageWatcher.show()的时候,多加一个构造函数 #8

wz1509 opened this issue Jun 15, 2018 · 0 comments

Comments

@wz1509
Copy link

wz1509 commented Jun 15, 2018

public void show(int position, List<ImageView> imageGroupList, final List<String> urlList) {
	show(imageGroupList.get(position), imageGroupList, urlList);
}
  1. 这个ImageView是可以通过imageGroupList.get(position)拿到;
  2. RecyclerView中存在着item复用,可能导致传的参数ImageView是第一次拿到的。
  3. RecyclerView中无论如何都能拿到position,即使多类型布局,可以通过adapter中保存ImageView和ImageUrl
// adapter
if (!urlList.contains(imageUrl)){
    urlList.add(imageUrl)
    imageList.add(imageView)
}

// show
val urlList = adapter.getUrlList()
imageWatcher.show(urlList.indexOf(imageUrl), adapter.getImageList(), urlList)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant