I think you should work with getItemViewType(int position) and
getViewTypeCount(), so Android knows there are different views for the
items.
Example (untested ugly style):
public int getItemViewType(int position) {
if ( position == 5 ) return 1;
else return 0;
}
public int getItemViewTypeCount() {
return 2;
}
public View getView(int position, View convertView, ViewGroup parent)
{
if ( getItemViewType(position) == 1 ) {
return imgView;
} else {
TextView tv;
if ( convertView != null ) { // Do this to save memory!
tv = (TextView) convertView;
} else {
tv = new TextView(TestActivity.this);
}
tv.setText("Entry #"+position);
tv.setMinimumHeight(50);
tv.setBackgroundColor(Color.DKGRAY);
return tv;
}
}
btw: Querying a fixed position might be a bad idea in the long run.
Isn't there a better criteria?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en