Android: ItemClickListener in ListView, which contains GridView -
i have listview , every item in listview contains gridview , header textview. want recognize when user clicks anywhere on whole item, tried set onitemclicklistener. unfortunately doesn't seem work because didn't debug log added click method.
my listview looks following
<listview android:id="@+id/listview_previous_issues" android:layout_width="match_parent" android:layout_height="wrap_content" android:descendantfocusability="blocksdescendants" android:layout_marginbottom="@dimen/article_separator_margin_topbottom" android:divider="@null" android:dividerheight="0dp" />
and gridview of list items this:
<gridview android:id="@+id/read_news" android:layout_width="match_parent" android:layout_height="wrap_content" android:numcolumns="auto_fit" android:columnwidth="@dimen/settings_and_issues_read_issues" android:stretchmode="columnwidth" android:verticalspacing="@dimen/paddingsmall" android:horizontalspacing="@dimen/paddingsmall" android:listselector="#00000000" android:focusable="false" android:focusableintouchmode="false" android:clickable="false"/>
update: call of onitemclicklistener
missuelist.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { log.d("debug", "klicke auf ressort mit der id " + pressorts.get(position).mressortid); //setze die ressort-id welche topnews angezeigt werden sharedpreferencehelper.setlongforkey(constants.prefs_shown_topnews_id, pressorts.get(position).mressortid); //refreshe die ansicht mcontext.refresh(); } });
i think gridview getting click event instead of listview, i'm not sure if correct. can point out have clickevents @ listview?
so, able solve problem on own. maybe helpful anyone:
i override dispatchtouchevent method of custom gridview, doesn't touch event
@override public boolean dispatchtouchevent(motionevent event) { return false; }
additionally, instead of onitemclicklistener set simple clicklistener @ each listitem in getview method of listadapter , worked.
Comments
Post a Comment