語言

BitmapFactory.Options.InPurgeable 屬性

定義

警告

deprecated

此會員已被棄用。

[Android.Runtime.Register("inPurgeable")]
[System.Obsolete("deprecated")]
public bool InPurgeable { get; set; }
[<Android.Runtime.Register("inPurgeable")>]
[<System.Obsolete("deprecated")>]
member this.InPurgeable : bool with get, set

屬性值

屬性

備註

此會員已被棄用。 目前 android.os.Build.VERSION_CODES#LOLLIPOP,這點被忽略了。

在 android.os.Build.VERSION_CODES#KITKAT 下方,若此設定為真,則產生的點陣圖會分配像素,以便在系統需要回收記憶體時可清除這些像素。 此時,當需要再次存取像素(例如繪製點陣圖,呼叫 getPixels() 時),像素會自動重新解碼。

<p>為了進行重新解碼,位圖必須能存取編碼資料,無論是透過共享輸入的參考,或是複製該資料。 此區分由 inInputShareable 控制。 如果這是真的,那麼位圖可能會對輸入保持淺層參考。 如果這是假的,位圖會明確複製輸入資料並保留。 即使允許分享,實作方仍可能決定對輸入資料做深度複製。</p>

<p>雖然 inPurgeable 能幫助避免大型 Dalvik 堆積分配(從 API 層級 11 開始),但會犧牲效能的可預測性,因為檢視系統嘗試繪製的任何影像都可能產生解碼延遲,進而導致幀遺失。 因此,大多數應用程式應避免使用 inPurgeable,以提供快速且流暢的使用者介面。 為了最小化 Dalvik 堆分配,改用 #inBitmap 旗標。</p>

<p 類=“note”><strong Note>:</strong> 此旗標在與或 #decodeResource(Resources, int, android.graphics.BitmapFactory.Options)#decodeFile(String, android.graphics.BitmapFactory.Options)使用 時<會被忽略。/p>

Java 文件 android.graphics.BitmapFactory.Options.inPurgeable。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於