爲了將圖像加載到列表視圖中(在我的情況下爲25 kb「個人檔案」圖片)昨天我綁定了picasso,因此圖像加載速度更快並緩存到磁盤。但從那時起,即使我不打開圖像加載的活動,我也會經常出現內存不足錯誤。 它可能是緩存不清除,所以我的應用程序不能處理任何服務器請求了?有人也會遇到這個問題嗎?或者我基本上做錯了什麼?畢加索內存不足錯誤?
Genreally我的應用程序開始加載谷歌地圖標記放置在由JSON請求給定的特定位置。如果我滑動到另一個地方加載這些標記,嘗試從服務器加載JSON時會發生內存不足錯誤。之前從未發生過,只是因爲我將picasso庫加入了我的應用程序。
,這裏是我的列表視圖列表項:
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="8dp"
android:id="@+id/friends_image"
/>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:layout_toRightOf="@+id/friends_image"
android:gravity="center_vertical"
android:id="@+id/list_item_friends_textview" />
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/text_view_id"
/>
你的圖片是否有這個屬性? :'android:adjustViewBounds =「true」'也試過'.fit()。centerCrop()' –
是的@rudi,在xml中 –
將它添加到所有的圖像上並測試它,並讓我知道它是否拋出內存 –