Compose 从 View 系统迁移

268 阅读1分钟

From Views to Compose: Where can I start?

迁移基于 View 的现有应用

在团队中使用 Compose

已有一个使用 View 构建的现有应用?了解如何采用增量方式进行迁移。

1. Migration Strategy

image.png

2. Adopt Compose in new features

New Feature in a New Screen

image.png

image.png

New Feature in an Existing Screen

image.png

3. Create a module of common UI components

buttons, app bars, chips, and so on. image.png

dialogs, cards, and so on. image.png

image.png

4. Incrementally migrate existing features one screen at a time

Rely on UI testing to prevent regressions.

image.png

image.png

image.png

5. Fragments

Once all the contents are in Compose. image.png

Remove Fragments and replace them with a corresponding screen level composable.

Use Navigation Compose to navigate and pass data between these screen-level composables.

image.png