j'ai réussi à comprendre comment créer une forme personnalisée (avec un trait pointillé) en créant un fichier appelé dash.xml à l'intérieur des /app/res/dossier drawable/:Comment créer un ListView avec des séparateurs de lignes en pointillés/pointillés sur Android?
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#534b4b"
android:width="1dp"
android:dashGap="2dp"
android:dashWidth="1dp"
/>
<size
android:height="1dp"
/>
</shape>
Maintenant, je suis confus quant à la façon d'appliquer cette forme à un ListView. J'ai essayé ce qui suit, mais aucun diviseur n'est affiché:
<ListView android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:divider="@drawable/dash"
android:dividerHeight="1dp"
/>
Wtf?
Vous devrez peut-être ajouter android: layerType = "software" au noeud référençant la forme. Au moins sur certains appareils, la ligne pointillée apparaîtra solide. – Steven
À titre d'exemple d'un périphérique sur lequel layerType résout problème de ligne continue est Nexus 5 avec 4.4.3. –
Ce doit être la réponse acceptée! travail impressionnant –