J'ai créé un TabHost
dans l'activité principale avec 4 spécifications de l'onglet. J'ai défini l'arrière-plan de l'hôte Tab (drawable, png image) et rendu toutes les activités dans les spécifications de l'onglet pour être transparent.Fond a TabHost sur Android
Par exemple:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!-- Dummy item to prevent EditText from receiving focus -->
<LinearLayout
android:focusable="true" android:focusableInTouchMode="true"
android:layout_width="0px" android:layout_height="0px"/>
<EditText android:id="@+id/etContactSearch"
android:layout_height="60dip"
android:layout_width="fill_parent"
android:drawableRight="@drawable/search_contact" >
</EditText>
<ListView android:id="@+id/lvContacts"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="1dp"
android:cacheColorHint="#00000000"
android:listSelector="@drawable/relative_layout_clickable">
</ListView>
</LinearLayout>
Et l'une des caractéristiques de l'onglet a quelques dispositions linéaires et de l'activité de la liste:
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bck_list">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp" />
</LinearLayout>
</TabHost>
Lorsque je démarre l'application d'Eclipse, la première fois qu'il fonctionne, le le fond (@drawable/bck_list
) est parfaitement représenté. Mais si je ferme l'application et l'exécute à nouveau, l'arrière-plan est manquant (la couleur noire est montrée à la place).
Quel peut être le problème ici?