語言

View.SetWillNotCacheDrawing(Boolean) 方法

定義

當 View 的繪圖快取啟用時,繪圖會被導往螢幕外的點陣圖。

[Android.Runtime.Register("setWillNotCacheDrawing", "(Z)V", "GetSetWillNotCacheDrawing_ZHandler")]
public virtual void SetWillNotCacheDrawing(bool willNotCacheDrawing);
[<Android.Runtime.Register("setWillNotCacheDrawing", "(Z)V", "GetSetWillNotCacheDrawing_ZHandler")>]
abstract member SetWillNotCacheDrawing : bool -> unit
override this.SetWillNotCacheDrawing : bool -> unit

參數

willNotCacheDrawing
Boolean

若此視圖未快取其繪圖,則為 false,否則為假

屬性

備註

當 View 的繪圖快取啟用時,繪圖會被導往螢幕外的點陣圖。 某些視圖,如 ImageView,若已繪製單一點陣圖,必須能繞過此機制,以避免不必要的記憶體使用。

此會員已被棄用。 隨著 API 11 引入硬體加速渲染,視圖繪製快取在很大程度上變得過時。 透過硬體加速,中間快取層大多不再必要,且由於建立與更新該層的成本,容易導致淨效能損失。 在少數需要快取層次的情況下,例如用於 alpha 動畫,則 #setLayerType(int, Paint) 會用硬體渲染來處理此問題。 對於軟體渲染的檢視階層中一小部分或個別檢視的快照,建議從 a Canvas 或 Bitmap 建立 a android.graphics.Picture 並呼叫#draw(Canvas)檢視。 然而,這些軟體渲染的使用不被鼓勵,且與硬體純渲染功能 android.graphics.Bitmap.Config#HARDWARE Config.HARDWARE 如點陣圖、即時陰影及輪廓裁切存在相容性問題。 建議使用 PixelCopy API 來製作使用者介面截圖、回饋報告或單元測試。

的 android.view.View.setWillNotCacheDrawing(boolean)Java 檔。

此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。

適用於