Android - add subview with layout params at specific index (in code)

Aleks G picture Aleks G · Jan 19, 2012 · Viewed 8.7k times · Source

I may be missing something, but I can't find a way to add a subview to a view at a specified index with specific layout params. There's addView(View v, LayoutParams lp) and there's addView(View v, int index) - but I can't find a way to specify both.

What am I missing?

Answer

Jong picture Jong · Jan 19, 2012

Why, there's a method with both: addView(View child, int index, ViewGroup.LayoutParams params): Here.