Je veux montrer des données de string.xml
de string-array
dans ce genre de tableaucomment afficher les données dans la liste-vue (recyclerview est mieux)?
ci-dessous est l'image de la table Je cherche:
Je dois faire custom adapter
mais je ne savent comment
est Ci-dessous le code pour mon habitude listview
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<TextView
android:id="@+id/list_item_string"
tools:text="asifgiouweifhsklajfhkh"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:gravity="center"
android:paddingLeft="8dp"
android:textSize="18sp"
android:textStyle="bold"
android:layout_toStartOf="@+id/quantityView"/>
<Button
android:id="@+id/delete_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:text="??" />
<TextView
android:text="QO"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/list_item_string"
android:layout_alignEnd="@+id/delete_btn"
android:layout_marginEnd="80dp"
android:id="@+id/unitView"/>
<TextView
android:text="1234"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/quantityView"
android:layout_alignBottom="@+id/unitView"
android:layout_toStartOf="@+id/unitView"
android:layout_alignParentTop="true"/>
Comment faire? Merci
vous pouvez utiliser listview et recyclerview pour cela. Il suffit de créer une mise en page pour chaque ligne. –
le code xml ci-dessus est la mise en page pour chaque ligne. il a plusieurs colonnes. J'ai fait quelques recherches que je dois faire un adapteur fait sur commande mais je ne sais pas comment faire cela. –
Je poste le code adaptateur personnalisé –