Reputation: 3415
I am looking to do something like this, using a GridView:
Note that the third item in the gridview is a textview+imageview, while the others are all textviews; and the imageview should have an id, so that I can handle the onClick.
How can I achieve this? I've tried filling the listitem.xml used here: ArrayAdapter<String> adaptor = new ArrayAdapter<String>(this, R.layout.listitem, data);
, filling it with a layout, but you can only pass one view.
Thanks in advance!
Upvotes: 0
Views: 85
Reputation: 496
You need to extend the BaseAdapter class, in the getView(...) method of the adapter you can specify exactly how you'd like your item to look like. You also have an index provided by the call-back and you could say that every 3'rd item should look in a specific way that you need.
Another thing you'd have to keep in mind of is the ViewHolder pattern. As a conclusion for your problem you've got the BaseAdapter implementation + ViewHolder pattern.
Upvotes: 1