Je suis en train de créer une application pour laquelle je souhaite prendre en charge la taille de plusieurs périphériques. Dans mon application, j'utilise un listview pour afficher des données ainsi qu'un adaptateur personnalisé. L'arrière-plan de la liste est une image que j'ai faite. Cette image est essentiellement une largeur de 114heightX700. avec un petit diviseur vertical à environ 1/4 de l'image.Aligner du texte dans ListView personnalisé au format table
Dans le côté gauche, j'ai besoin de centrer les chiffres avec maximum 3 chiffres et à gauche, un titre.
Cela fonctionne très bien sur le Nexus 4, mais si j'essaie d'autres périphériques avec des ppp différents, il ne se centre plus. Existe-t-il un moyen de "découper" le positionnement du texte dans l'image donnée afin qu'il soit toujours à la même position quel que soit le périphérique?
Voici mon XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:contentDescription="@string/empty"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/imageView1"
android:layout_alignLeft="@+id/imageView1"
android:layout_alignParentTop="true"
android:baselineAligned="false"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="75dp"
android:layout_height="match_parent"
android:layout_weight="0.00" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/empty"
android:textColor="@android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.89"
android:paddingLeft="10dp" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:lines="1"
android:paddingRight="10dp"
android:text="@string/empty"
android:textColor="@android:color/white"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>