2016-11-23 170 views
0

嘿我使用recyclerview與列表卡設計和每張卡我有一個圖像,而不是一個大的重量1.5 MB我正在加載12張卡,但滾動是如此laggy我試過使用PICASSO和它沒有幫助,事情是當我用一個更小的一個(300字節)的圖像替換它滾動良好,但它不能解決我的問題..但RecyclerView滾動非常緩慢和遲緩

卡的相關部分xml是:

<android.support.v7.widget.CardView 

     android:id="@+id/card_item" 

     android:layout_width="match_parent" 

     android:layout_height="wrap_content" 

     android:layout_gravity="center" 

     android:clickable="true" 
     card_view:cardCornerRadius="4dp"> 



     <RelativeLayout 

      android:id="@+id/cont_card_content" 

      android:layout_width="match_parent" 

      android:layout_height="wrap_content" 

      android:clickable="true" 
      android:background="#FFFFFF"> 



      <ImageView 

       android:id="@+id/im_item_icon" 

       android:layout_width="wrap_content" 

       android:layout_height="170dp" 

       android:scaleType="fitXY" 

       android:layout_alignParentTop="true" 
       android:layout_alignParentStart="true" /> 

,因爲我是說我試圖用PICASSO,並沒有幫助

Picasso.with(context).load(R.drawable.bg_partyt).into(holder.imageView); 

有什麼想法?

+0

1.5mb很大,所以請嘗試使用畢加索的.fit()方法。 fit()將測量目標ImageView(@ + id/im_item_icon)的尺寸,然後使用Picasso自己的resize()方法將圖像尺寸縮小到目標ImageView的尺寸。 更多的信息在這裏:https://futurestud.io/tutorials/picasso-image-resizing-scaling-and-fit – MikeOscarEcho

+0

你可以發佈包括recyclerView的佈局代碼嗎? – muthuraj

+0

我正在嘗試使用.fit(),但它根本不顯示圖像。 – orisgoofo

回答