自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
ViewCapture
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
ViewCapture 傾印是視窗檢視區塊階層在特定時間點的快照,包括位置、大小、比例和顯示設定。另一方面,ViewCapture 追蹤記錄會提供狀態的時間順序,提供有關檢視畫面隨時間變化的行為洞察資料。簡單來說,ViewCapture 會擷取視窗內的檢視畫面資訊及其屬性,讓您瞭解特定時刻的使用者體驗,並追蹤時間變化。這有助於排解電池圖示遺失或通知閃爍等問題。
Winscope 的 ViewCapture 檢視器可讓您以視覺化方式呈現某個時間點的檢視狀態、觀看檢視畫面隨時間變化情形,以及分析檢視畫面階層資料中的錯誤或異常情形。與螢幕錄影相比,逐格視覺化效果可讓您更輕鬆地檢查檢視狀態。收集檢視記錄的 CPU 使用率也比螢幕錄影低,因此更容易啟用。
如要進一步瞭解追蹤記錄收集作業,請參閱 ViewCapture。
分頁結構
「ViewCapture」分頁會分成三個面板:矩形檢視畫面、階層檢視畫面和屬性檢視畫面:
圖 1. ViewCapture 追蹤記錄分析。
矩形檢視畫面
畫面左側會顯示檢視畫面階層的 3D 檢視畫面。矩形檢視畫面會考量檢視畫面邊界、z 順序和不透明度。
矩形檢視畫面頂端的選單會顯示所有可用的視窗。選擇要顯示的內容時,您可以選取特定視窗或所有視窗:
圖 2. ViewCapture 矩形檢視畫面。
階層檢視
分頁的中央區塊會顯示檢視區塊階層。除了檢視畫面之間的父子關係,這個檢視畫面還包含下列資訊:
資源檢視畫面
為簡化偵錯作業,ViewCapture 檢視器會提供經過精選的屬性清單,以更有條理的方式呈現資訊。這份清單包含以下類別:
- View:檢視畫面 ID。
- 幾何圖形:關於檢視區塊幾何圖形的座標、大小、比例和其他詳細資料。
- Effects:檢視畫面的效果和其他各種屬性。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# ViewCapture dumps are snapshots of a window's view hierarchy at a specific time,\nincluding location, size, scale, and visibility. ViewCapture traces, on the\nother hand, provide a chronological sequence of states, offering insights into\nhow views behave over time. Simply put, ViewCapture captures information about\nviews within a window and their properties, letting you understand the user\nexperience at specific moments and track changes over time. This is useful for\ntroubleshooting issues like *my battery icon is missing* or *my notification\nflickered*.\n\nWinscope's ViewCapture viewer lets you visualize the view state at a moment in\ntime, watch view changes over time, and analyze view hierarchy data for bugs or\nanomalies. The frame-by-frame visualization makes it easier to inspect view\nstates compared to screen recordings. Collecting view traces is also less\nCPU-intensive than screen recording, making it easier to enable.\n\nSee [ViewCapture](/docs/core/graphics/winscope/capture/adb#capture-adb-vc)\nfor more information about trace collection.\n\nTab structure\n-------------\n\nThe ViewCapture tab is split in three panels: rects view, hierarchy view, and\nproperties view:\n\n**Figure 1.** ViewCapture trace analysis.\n\n### Rects view\n\nThe left side of the screen features a 3D view of the view hierarchy. The rects\nview considers view bounds, z-order, and opacity.\n\nThe rects view has a menu at the top that displays all available\nwindows. You can select a specific window or all of them when choosing what to\ndisplay:\n\n**Figure 2.** ViewCapture rects view.\n\n### Hierarchy view\n\nThe tab's central segment shows the view hierarchy. In addition to the\nparent-child relationships between view, this view also includes the following\ninformation:\n\n- **V:** Identifies visible views.\n\n### Properties view\n\nTo make debugging easier, the ViewCapture viewer provides a curated list of\nproperties, presenting the information in a more organized format. This list\nincludes the following categories:\n\n- **View:** View identifier.\n- **Geometry:** Coordinates, size, scale, and other details about the view geometry.\n- **Effects:** Effects and other miscellaneous properties for the views."]]