I'm experiencing a huge frame rate / frame skip when scrolling through my card view. I read somewhere that it might be because i am loading images straight into the page rather than use Picasso but not sure if this would help. Wondering if anyone has experienced this before and knows how to fix ?
<androidx.cardview.widget.CardView
android:id="@+id/cardview1"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_below="@+id/cardview"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginTop="10dp"
android:layout_marginRight="16dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="15dp"
app:cardElevation="10dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:paddingLeft="10dp"
android:text="Green Torso"
android:textColor="@color/cardview_dark_background"
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/ShopGreenTorso"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/green_torso"/>
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="bottom"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/register_button"
android:shadowColor="@color/colorPrimary"
android:text="20S Buy"
android:textColor="@color/white">
</Button>
</androidx.cardview.widget.CardView>
This is my code but i have only shown one cardview to keep the code short. The other 5 are identical to this just with different images.
Thanks all in advance.
Determined that it was my device that was slow; Advice to anyone who is developing a mobile app is make sure to test on multiple devices. It did not run very smoothly on an LG G3, however was flawless on a OnePlus 3T. I'm sure there are people out there who could optimise this, but for most casual app developers, switching devices did the trick.