If you want to add a View
to specific position in a ViewGroup
, you can use addView(view, position)
. In this case, assuming main_interface
is the first View
, you can call main_layout.addView(bar, 0)
.
However, you need to fix your layout first. If you use FrameLayout
as your main_layout
and set main_interface
height and width to match_parent
, then they will surely overlap. Try making your main_layout
a LinearLayout
with android:orientation="vertical"
if you want vertically stacked View
s.
If you could post your actual XML layout, I could help you modify and test it.