
Untitled
By: a guest on
Jul 17th, 2012 | syntax:
None | size: 0.63 KB | hits: 12 | expires: Never
Is it possible to use view inflator to inflate individual items?
public View getView(int position,View v,ViewGroup parent) {
if (v == null) {
v = li.inflate(R.layout.grid_item,null);
final TextView tv = (TextView) v.findViewById(R.id.grid_text);
tv.setText(String.valueOf(position+1));
}
if (v == null) {
if(position < 5){//whatever condition you want here
v = li.inflate(R.layout.grid_item,null);
}
else{
v = li.inflate(R.layout.grid_item2,null);
}
}
final TextView tv = (TextView) v.findViewById(R.id.grid_text);
tv.setText(String.valueOf(position+1));
or