Benutzerdefiniertes Listenansichtselement in ListViewDragginganimation
So habe ich ein Android-Projekt, in dem ich eine Sortierfunktion gut verwende. Ich benutzeDevBytes
ListViewDraggingAnimation
https: //www.youtube.com/watch? v = _BZIvjMgH-Q
Ich habe es in meiner App und meinem Layout zum Laufen gebracht, aber ein großes Problem bleibt bestehen: Ich kann es nicht zum Laufen bringen mit meinem benutzerdefiniertenListView
Artikel. Der Lagerartikel inDevBytes
code ist ein einfachesTextView
so wie
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF"
android:textSize="@dimen/list_text_size"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:minHeight="@dimen/list_item_height"
android:textColor="#000000"
/>
Meine benutzerdefinierteListView
Elemente bestehen aus einemRelativeLayout
mit vierTextView
s drinnen. So wie
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="adress"
android:id="@+id/item_adressView"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/item_driveTypeView"
android:textSize="15dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="postnr, ort"
android:id="@+id/item_zipcodePlaceView"
android:textSize="15dp"
android:layout_below="@+id/item_adressView"
android:layout_toEndOf="@+id/item_driveTypeView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="företag"
android:id="@+id/item_companyView"
android:textSize="15dp"
android:layout_below="@+id/item_zipcodePlaceView"
android:layout_toEndOf="@+id/item_driveTypeView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="P1"
android:id="@+id/item_driveTypeView"
android:textSize="40dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
Zugegeben, ich verstehe die Datenstruktur nicht gut. Bei jedem Versuch, den ich unternommen habe, um meine Artikel zu akzeptieren, ist das Programm abgestürzt. Ich fürchte, ich habe bei einigen Versuchen mehr Teile des Codes geändert als benötigt. Könnte mir jemand helfen, herauszufinden, welche Teile des Codes ich ändern muss, um das @ zu erhalteListView
um meine benutzerdefinierten Artikel zu akzeptieren?
Posting alle Java-Code wird mein Beitrag die Zeichenbeschränkung überschreiten.
Der Code ist hier zu finden:http: //developer.android.com/shareables/devbytes/ListViewDraggingAnimation.zi