如何将OnClickListener设置为Android中的图像?

问题描述 投票:-2回答:1

我想在不同的活动中显示从gridview到的图像。

如何从Gridview获取图像的位置?bindView是视图持有者

android android-studio imageview android-gridview
1个回答
0
投票

onCreateViewHolder中输入

vh = ViewHolder(...)

vh.imageView.setOnClickListener {
   val position = vh.adapterPosition
   position is the current position of the imageview
}
© www.soinside.com 2019 - 2024. All rights reserved.