Giải pháp chuyển đổi số trọn gói cho doanh nghiệp Việt

Fragment_item_list.xml - Tài liệu lập trình android

Tài liệu lập trình android

← Toàn bộ tài liệu


Bước 2: Fragment_item_list.xml

Bài 2/36 Xem dạng sách

Tên file cần tạo: fragment_item_list.xml

Cấu trúc tên 

Fragment_items_list.xml: trong đó items là các đối tượng mà chúng ta muốn hiển thị ví dụ như Fragment_cars_list.xml, Fragment_pets_list.xml...

Nơi đặt file này: app/src/main/res/layout

Nơi này để chứa danh sách các items

Nội dung của file như sau

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">

<data>

<variable
name="loadingMore"
type="boolean" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/itemListRecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingTop="@dimen/space_16"
android:paddingStart="@dimen/space_20"
android:paddingEnd="@dimen/space_20"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@+id/progressBar3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

<ProgressBar
android:id="@+id/progressBar3"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:indeterminate="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:visibleGone="@{loadingMore}" />

</androidx.constraintlayout.widget.ConstraintLayout>

</layout>

Trong đó các bạn lưu ý phần bôi đậm. 

itemListRecyclerView: Phần này là tên của RecyclerView. ở đây items là một đối tượng mà chúng ta muốn tạo, ví dụ carsRecyclerView. petsRecyclerView....

 

Sơ đồ quan hệ các bảng

Table Name: {{table.name}}
Num Name Type
{{field_index+1}}
{{field.name}} {{field.type}}

Hỏi đáp

Gửi với tên {{comment_full_name}}

Chưa có câu hỏi nào cho bài này.

Zalo 0936.006.058 Hotline 0936.006.058