I have a ListView which has been constructed, styled and had an adapter set from code which is common across both devices.
Curiously however, on my phone (2.3.4) only the text is clickable. On the Tablet (3.1) the entire ListView item is clickable. On the tablet the text is also right aligned.
The only difference is that on the Tablet the ListView has had it’s LayoutParams width set programmatically to “240dp”.
So far I haven’t added any listeners to either the Views from the adapter (a SimpleCursorAdapater) or on the ListView itself.
Has anyone run into this before?
Bit ready to end it all at this point,
I eventually stumbled upon the solution in my investigations:
I changed the XML governing the
ListView– It was set to"wrap_content"(so the width of theListViewwas the width of the largest element of the list). I instead set it’s width to"match_parent"to stretch across it’s container.Apparently each item of a
ListViewset to"match_parent” will inherit the initial attributes of their parents, not their current attributes (at least not in terms of width/height). Broken unintuitive logic if you ask me.