Right now I am using a custom list view and I am inflating an xml file to be viewed. I wanted to inflate the layout to have different inflations depending on the position.
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));
}
Grid item is what i am inflating. I want to inflate several different items depending on the position while still keeping the text view. Currently to do this I have an image inside grid_item that I am changing, but I would rather do it this way.
OK so if you want to inflate a different xml based on the position then just use some old school code I would say, something like
then just make sure to name the text field in all of your xmls grid_text and you are good to go.