I have an adapter that has several view types defined like
public class ListAdapter BaseAdapter {... @ Override Public Entry Typecount () {Return 2; } @ Override Public Intuit item VU Type (int i) {return (boole ())? 1: 0); } @ Override Public View getView (int i, View View, ViewGroup ViewGroup) {int type = getItemViewType (i); If (type == 1) {return view type (R.layout.list_item_ads_alert, i, see, view group); } And {return view type (R.lit.list_itemads, i, see, view group); }}}
Then in my pieces I intimate it and set it in the list, plus I add an item listener to it
ListAdapter adapter = new ListAdapter (); ListView.setAdapter (adapter); ListView.setOnItemClickListener (New AdapterView.OnItemClickListener) {@Override Public Zero onItemClick (AdapterView & LT;? & Gt; AdapterView, View View, J., Long L) {Log.d ("Application", "Push Item" + I);}});
The problem is that when I click on an item of another type of type is not called My ItemClickListener, but it works for the first viewing type
< P> Do you know if there is a specific way to itemclick for this matter? Of course I can add an onClick to the second type of type, but it does not look correct (code separation)
< P> If your 2 scene types are a checkbox or a button, then that widget is stealing the focus from the generator view, and no permission to click the parent view. In order to prevent your occurrence of your 2 visual type in its root layout, you should keep
android: descendantFocusability = "blocksDescendants"
The idea of parents is not able to steal the focus.
No comments:
Post a Comment