5-qadam: Yangi tartib yarating-> rec-> layout-> list_view_items.xml va quyidagi kodni qo‘shing:
Ushbu bosqichda biz ListView elementlarini ko‘rsatish uchun xml faylini yaratamiz. Ushbu xml-da biz ImageView va TextView-ni ko‘rsatish uchun kodni qo‘shamiz.
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
android:id="@+id/imageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="5dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="@drawable/ic_launcher" />
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/activity_horizontal_margin"
android:text="Demo"
android:textColor="#000" />
Chiqish:
Endi ilovani ishga tushiring va siz ListView ro‘yxatida turli xil meva nomlariga ega bo‘lasiz. Bu erda biz ListView-da ma'lumotlarni to‘ldirish uchun Simple Adapter-dan foydalandik.
Do'stlaringiz bilan baham: |