tags:

views:

154

answers:

0

I defined two ImageButton which are contained in a LinearLayout in my XML layout file:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:minHeight="40px" android:background="@drawable/library_tabs_background">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/button_library"
android:layout_width="160px"
android:paddingTop="7px"
android:layout_height="40px"
android:paddingLeft="30px"
android:orientation="horizontal">
<ImageButton
android:id="@+id/list"
android:layout_width="110px"
android:layout_height="30px"
android:src="@drawable/library_tab1_button_active">
</ImageButton>
</LinearLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/button_search"
android:layout_width="160px"
android:paddingTop="7px"
android:layout_height="40px"
android:orientation="horizontal">
<ImageButton
android:id="@+id/search"
android:layout_width="110px"
android:layout_height="30px"
android:src="@drawable/library_tab2_button_deactive">
</ImageButton>
</LinearLayout>

</LinearLayout>

As one can see in the XML file, also the LinearLayout in which the buttons are contained, a background image is set. This two images (the button background and the linearlayout background) are overlapping.

So in some views, the button background is in front of the layout background and in other views (im using a view flipper), the background of the layer is in the foreground.

How can i set a clear rule? How does Android decide which BackgroundResource to draw first?