gridView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView> parent, View v,
int position
Here's the cleanest way to do it: call performItemClick() on the GridView from within each button's click listener in your Adapter. That way you can still use the GridView's onItemClickListener like normal.
// in your ListAdapter
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
// set btn to be your item's view
...
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((GridView) parent).performItemClick(v, position, 0);
}
});
}
From http://www.migapro.com/click-events-listview-gridview/
does the gridView have a custom layout ?
if yes, go to the custom layout xml file and change these attributes
android:clickable="false"
android:focusable="false"