Giải pháp chuyển đổi số trọn gói cho doanh nghiệp Việt
Nội dung file, giả sử item của chúng tả chỉ hiển thị mỗi name và có trường là item_name
Nơi đặt file fragment_item.xml: res/layout
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="item" <! -- Đặt tên item để lát hiển thị item_name ở dưới -->
type="com.vantinviet.adayroionline.viewobject.Item" /> <! -- Gọi đối tượng item trong viewobject -->
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<! -- Tạo một ô text view để hiện thị item name -->
<TextView
android:id="@+id/item_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="@{item.item_name}" <! -- Gọi giá trị của item_name -->
android:textAlignment="viewStart"
android:textColor="@color/md_black_1000"
android:textSize="@dimen/font_title_size"
app:font='@{"normal"}'
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent"
tools:text="Name" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</layout>
Chú ý quan trọng: việc xây dựng hiển thị mội item là rất quan trọng do đó các bạn cần phải nắm được các đối tượng thể hiện của item
ví dụ như hiển thị ảnh của item, hiển thị ngày tháng, và hiển thị rất nhiều các thông tin khác.
Để tìm hiểu sâu về phần này các bạn tham khảo tại đây
Chưa có câu hỏi nào cho bài này.