2013-11-28 98 views
0

当我尝试为GridView(AdapterView)设置单击侦听器时,程序细分和Logcat:“不要为AdapterView调用setOnClickListener”。为什么setOnClickListener()不适用于GridView(AdapterView)

添加:为什么机制(Adapterview无法通过点击调用)像这样工作?

+3

改为使用'setOnItemClickListener()' – SathishKumar

+0

问题不清楚给一些更多的信息以及代码.. –

+1

O Lord!请发布您的代码和日志猫跟踪。 – RobinHood

回答

0

尝试使用onItemClick

public abstract void onItemClick (AdapterView<?> parent, View view, int position, long id) 

Added in API level 1 
Callback method to be invoked when an item in this AdapterView has been clicked. 

Implementers can call getItemAtPosition(position) if they need to access the data associated with the selected item. 
0

你应该尝试setOnItemClickListener功能。

相关问题