How to retrieve the right view?
My adapter contain the following Views:
private static class ViewHolder {
ImageView p_Image;
TextView p_Name;
TextView p_Price;
TextView p_Psave;
}
This Is ho开发者_运维问答w I implement onItemClick :
gridView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
}
});
How can I know which view from the above 4 was actually pressed (while running OnItemClickListener via GridView) ?
Thanks
The second parameter to onItemClick
, View v
is a reference to the view that was clicked. You can compare this to your views to see which one it was.
精彩评论