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

请添加item的点击事件 #3

Open
klower opened this issue Jul 26, 2017 · 10 comments
Open

请添加item的点击事件 #3

klower opened this issue Jul 26, 2017 · 10 comments

Comments

@klower
Copy link

klower commented Jul 26, 2017

请添加item的点击事件 谢谢

@ChenLittlePing
Copy link
Owner

你好,item点击事件和Recyclerview的添加方式是一样的,在Adapter中添加接口回调即可。

@klower
Copy link
Author

klower commented Jul 27, 2017

你好,
class ViewHolder extends RecyclerView.ViewHolder {
ImageView img;
public ViewHolder(View itemView) {
super(itemView);
img = (ImageView) itemView.findViewById(R.id.img);
itemView.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
Toast.makeText(mContext,"position: "+ getAdapterPosition(), Toast.LENGTH_SHORT).show();
}
});
}
}

添加了点击时间,页面被切成很多部分了
image

@klower
Copy link
Author

klower commented Jul 27, 2017

不好意思 是我理解错了 原来你加了viewpager 我进入MainActivity就OK 了 效果很好 赞。。。

@klower
Copy link
Author

klower commented Jul 27, 2017

另外有个 功能希望添加一下, 就是用户点击两边的item, 能不能让这个item 滑动到中间来, 还有能不能 添加setCurrentItem(int position) 方法 谢谢

@ChenLittlePing
Copy link
Owner

@klower 调用RecyclerCoverFlow的smoothScrollToPosition方法就可以了

@klower
Copy link
Author

klower commented Jul 27, 2017

这个方法可行
不好意思 还有个效果就是没选中的item 能不能加上一定的灰度值

@ChenLittlePing
Copy link
Owner

拉取最新代码可以设置灰度渐变和半透明渐变
mList.setGreyItem(true); //设置灰度渐变
mList.setAlphaItem(true); //设置半透渐变

@ChenLittlePing
Copy link
Owner

最新代码已经添加了改变Item灰度的功能,如果需要修改效果的话,可以修改CoverFlowLayoutManager中greyItem方法里面的颜色矩阵参数来调整

@klower
Copy link
Author

klower commented Jul 28, 2017

太感谢 效果杠杠滴 大神 厉害 威武

@SrDino
Copy link

SrDino commented Aug 4, 2017

你好,我通过这个方法getIntervalDistance修改item的间隔的时候,如果里面小于0.5就会出现后面的一张将前面的一张给覆盖了,怎么回事?

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

3 participants