J'ai rencontré ce problème lors de la mise à jour de mon arrière-plan pour utiliser une image de 9 patchs. La mise en page est bien sur différents écrans en utilisant différentes tailles de la même image, mais quand je change l'image pour être un 9-patch, il brise mystérieusement toute la disposition.Mise en page Android brisée avec un fond de 9 patchs
La mise en page précédente ressemble à ceci:
Original layout http://onik.org/android/layoutOk.png.
Lorsque changé à 9-patch:
9-Patch image http://onik.org/android/layoutError.png.
Le fichier XML est resté le même, seuls les fichiers PNG ont été modifiés.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg">
<TextView
android:text="@string/title"
android:id="@+id/login_title"
android:layout_width="fill_parent"
android:layout_height="40px"
android:textSize="30px">
</TextView>
<View
android:id="@+id/login_underline"
android:layout_width="wrap_content"
android:layout_height="2px"
android:background="#aaaaaa">
</View>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:stretchColumns="1"
android:gravity="center"
android:paddingLeft="10px"
android:paddingRight="10px">
<TableRow>
<TextView
android:id="@+id/login_usernameLabel"
android:text="@string/login_usernameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5px">
</TextView>
<EditText
android:text=""
android:id="@+id/login_username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:lines="1"
android:nextFocusDown="@+id/login_password">
</EditText>
</TableRow>
<TableRow>
<TextView
android:id="@+id/login_passwordLabel"
android:text="@string/login_passwordLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<EditText
android:text=""
android:id="@+id/login_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:nextFocusDown="@+id/login_login"
android:inputType="textPassword">
</EditText>
</TableRow>
<TableRow android:gravity="right">
<Button
android:text="@string/login_login"
android:id="@+id/login_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</Button>
</TableRow>
<TableRow>
<CheckBox
android:id="@+id/login_remember"
android:text="@string/login_remember"
android:layout_span="2">
</CheckBox>
</TableRow>
</TableLayout>
</LinearLayout>
Des idées? Ou d'autres solutions pour obtenir un arrière-plan centré sans échelle?
Pourriez-vous re-télécharger les images ici –
Oh, désolé, j'ai oublié qu'ils étaient liés ici, je vais essayer de voir si j'ai de vieilles sauvegardes à la maison, mais je pense qu'ils sont partis ... – onik
Vous avez sauvé ma journée.C'était très difficile à déboguer.Merci !!! –