I've this layout hierarchy:
<FrameLayout>
<ScrollView>...</ScrollView>
<LinearLayout>...</LinearLayout>
<LinearLayout>...</LinearLayout>
</FrameLayout>
Using the Android Device Monitor I've dumped the view hierarchy and I've achieved this:
As expected. But if I include two more layouts:
<FrameLayout>
<ScrollView>...</ScrollView>
<LinearLayout>...</LinearLayout>
<LinearLayout>...</LinearLayout>
<include layout="@layout/a_framelayout"/>
<include layout="@layout/another_framelayout"/>
</FrameLayout>
Note: a_framelayout
contains a LinearLayout
and another_framelayout
contains a View
.
I get this:
Shouldn't this two layouts have a index of 3 and 4 respectively instead of 0 and 2? And why is the ScrollView
between them?
If I change the layout to:
<FrameLayout>
<include layout="@layout/a_framelayout"/>
<include layout="@layout/another_framelayout"/>
<ScrollView>...</ScrollView>
<LinearLayout>...</LinearLayout>
<LinearLayout>...</LinearLayout>
</FrameLayout>
I get:
It makes more sense, but now the a_framelayout
was swapped with another_framelayout
, why?
Although this strange layout behaviour happened, all views were correctly rendered in the screen and the layout works as it should.
Any clue?
Thanks for your time.