开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜