I found the answer:
layout = (RelativeLayout)findViewById(R.id.rellayout);
LayoutInflater layoutInflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout.addView(layoutInflater.inflate(R.layout.gegevens_verzekeringen, group, false), 1 );
This loads the view over the parent xml. I want it to load it on top of the body part (blue part of the image)
I declared the body as follows:
body = (RelativeLayout)findViewById(R.id.body);
But when I do body.addView(layoutInflater.inflate(R.layout.gegevens_verzekeringen, group, false), 1);
This is sais java.lang.IndexOutOfBoundsException: index=1 count=0
How can i fix this?
Edit: it turned out:
body.addView(layoutInflater.inflate(R.layout.gegevens_verzekeringen, null));
Galip source
share