2017-02-24 64 views
1

我是android開發新手。在我的應用程序中,我有一個包含圖像的horizontalScrollView。後來我一直在使用畢加索從URL加載圖像。然後我聽說下滑,所以我轉而滑動,現在我的圖像加載速度很快,但圖像質量太低。幫助我獲得正確的圖像質量。android - 使用滑行時圖像質量很低

代碼如下

//load image from URL 1.1 
     ivImageFromURL = (ImageView) findViewById(R.id.videoconwmimage); 
     Glide.with(this).load("http://imgur.com/KtfpVUb.png").into(ivImageFromURL); 
+0

代碼在哪裏? – Piyush

+0

看起來像你的圖像不是高分辨率圖像 – Piyush

+0

當我使用畢加索圖像看起來很好... – Simon

回答

2

這是因爲滑翔默認位圖格式設置爲RGB_565,因爲它是與畢加索使用的ARGB_8888相比,僅消耗了50%的內存空間。

你能解決這個問題作出以下修改:

public class GlideConfiguration implements GlideModule { 

    @Override 
    public void applyOptions(Context context, GlideBuilder builder) { 
     // Apply options to the builder here. 
     builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888); 
    } 

    @Override 
    public void registerComponents(Context context, Glide glide) { 
     // register ModelLoaders here. 
    } 
} 

並添加以下到您的清單:

<meta-data android:name="com.inthecheesefactory.lab.glidepicasso.GlideConfiguration" 
      android:value="GlideModule"/> 

欲瞭解更多詳情,請訪問here