改善版面配置效能
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
試用 Compose
Jetpack Compose 是 Android 推薦的 UI 工具包。瞭解如何在 Compose 中使用版面配置。
版面配置是 Android 應用程式的重要部分,會直接影響使用者體驗。如果實作時效能不佳,版面配置可能會因為 UI 速度緩慢而耗用大量應用程式記憶體。Android SDK 內含有助於找出版面配置效能問題的工具。這份文件可讓您以最少的記憶體用量導入流暢的捲動介面。
課程
- 最佳化版面配置階層
- 就像複雜的網頁會拖慢載入時間一樣,複雜的版面配置階層也可能引發效能問題。本說明文件說明如何使用 SDK 工具檢查版面配置,以及找出效能瓶頸。
- 透過 <include> 重複使用版面配置
- 如果應用程式 UI 在多個位置重複特定版面配置結構,這份說明文件會說明如何建立高效率、可重複使用的版面配置結構,並將其納入適當的 UI 版面配置中。
- 視需求載入檢視畫面
- 除了在另一個版面配置中加入一個版面配置元件之外,您可能還希望只有在活動執行後,才有需要時顯示已加入的版面配置。本說明文件會說明如何視需要載入版面配置的部分,改善版面配置的初始化效能。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","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-26 (世界標準時間)。"],[],[],null,["# Improve layout performance\n\nTry the Compose way \nJetpack Compose is the recommended UI toolkit for Android. Learn how to work with layouts in Compose. \n[Performance in Compose →](/jetpack/compose/performance) \n\nLayouts are a key part of Android applications that directly affect the user experience. If\nimplemented poorly, your layout can make your app memory-intensive with slow UIs. The Android\nSDK includes tools to help identify problems in your layout performance. With this documentation,\nyou can implement smooth scrolling interfaces with a minimal memory footprint.\n\nLessons\n-------\n\n**[Optimize layout hierarchies](/develop/ui/views/layout/improving-layouts/optimizing-layouts)**\n: In the same way that a complex web page can slow down load time, a complex layout hierarchy\n can also cause performance problems. This documentation shows how you can use SDK tools to\n inspect your layout and discover performance bottlenecks.\n\n**[Reuse layouts with \\\u003cinclude\\\u003e](/develop/ui/views/layout/improving-layouts/reusing-layouts)**\n: If your application UI repeats certain layout constructs in multiple places, this\n documentation shows you how to create efficient, reusable layout constructs and include them\n in the appropriate UI layouts.\n\n**[Load views on demand](/develop/ui/views/layout/improving-layouts/loading-ondemand)**\n: Beyond including one layout component within another layout, you might want to\n make the included layout visible only when it's needed after the activity is running.\n This documentation shows how you can improve your layout's initialization performance by loading\n portions of your layout on demand."]]