تابستون داره تموم میشه ها، فرصت‌ها محدودن کلی آفر جذاب در کمپین تابستون🔥👇
۰ ثانیه
۰ دقیقه
۰ ساعت
۱ رضا فرجی
مشکل در مورد ریسایکلر ویو
جامعه جاوا (اندروید) ایجاد شده در ۰۶ تیر ۱۴۰۰

سلام دوستان وقت بخیر. من یک ریسایکلر وییو دارم که پیجینگ روش راه اندازی کردم بصورتی که اگر به ۲ تا آیتم مونده به آخر برسه، api مربوط به پیجینگ کال میشه و محصولات جدید لود میشه. حالا مشکل من اینه که این ریسایکلر ویو من در داخل این لیوت موقعی که صفحه مربوطه باز میشه، همه آیتم‌ها رو یکجا لود میکنه و این باعث میشه هر لحظه پیجینگ کال بشه و گوشی هنگ کنه و در صورتی این مشکل درست میشه که یک height ثابت به ریسایکلر ویو بدیم. این هم لیوت:

 

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </com.google.android.material.appbar.AppBarLayout>
    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
           app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/similarProductsRv"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="8dp"
                android:layout_marginTop="8dp"
                android:layout_gravity="top"
                android:layout_marginRight="8dp"
                android:clipToPadding="false"
                android:paddingBottom="56dp" />
            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">
            </androidx.constraintlayout.widget.ConstraintLayout>
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

سلام وقت بخیر

 

چرا از لایبرری paging ۳ استفاده نمیکنید تا این کار رو مدیریت کنید؟

پوریا شفیعی ۰۷ تیر ۱۴۰۰، ۱۹:۱۰