Создал свою разметку для ListView
. Вот код:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
app:srcCompat="?android:attr/alertDialogIcon"
android:id="@+id/imgView"
android:layout_weight="0.02"
android:layout_marginRight="10dp"
android:maxWidth="50dp"
android:maxHeight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="@+id/txtView"
android:layout_weight="1" />
</LinearLayout>
А в MainActivity через адаптер из коллекции выводятся данные на данный момент в стандартную разметку
arrayAdapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1, tmpArr);
list.setAdapter(arrayAdapter);
Как вывести данные из коллекции в txtView
из ListView
?