2014-09-10 29 views
0

我想讓畢加索加載一個位圖。當我嘗試使用Picasso.with(getActivity()).load(bitmap1).into(image);它給我錯誤he method load(Uri) in the type Picasso is not applicable for the arguments (Bitmap)畢加索加載已經創建的位圖?

我該如何做到讓畢加索加載我的位圖?謝謝。

+0

什麼是bitmap1? – 2014-09-10 17:10:45

+1

你不需要畢加索爲此....畢加索是從互聯網上加載圖像。只需使用'image.setImageBitmap(bitmap);' – 2014-09-10 17:11:36

+0

@Nadeem Iqbal這是一個位圖。 – Jack 2014-09-10 17:14:57

回答

-1

你不需要畢加索來做到這一點。畢加索是從互聯網或從磁盤加載圖像。您可以顯示你的ImageView一個Bitmap這樣的:

image.setImageBitmap(bitmap); 
+0

我使用畢加索的原因是因爲它處理圖像效果非常好,當我使用「image.setBackground(new BitmapDrawable(bitmap));」它滯後可怕。 – Jack 2014-09-10 17:13:50

+0

@傑克那麼你正在做一些可怕的錯誤。如果你這樣做,即使圖像很大,它也不應該滯後。在我的答案中試試這個建議。 – 2014-09-10 17:16:17

0

加載本地資源也是可以的,因爲你可以在這裏看到:http://square.github.io/picasso/

RESOURCE LOADING 
Resources, assets, files, content providers are all supported as image sources. 

Picasso.with(context).load(R.drawable.landing_screen).into(imageView1); 
Picasso.with(context).load(new File(...)).into(imageView2); 

卜你不應該嘗試創建位圖。我認爲滯後的原因是實際的位圖創建。