summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid API Council <no-reply@android.com>2023-12-07 12:55:13 -0800
committerAndroid API Council <copybara-worker@google.com>2023-12-07 12:55:43 -0800
commitc66ddc1d499595765d4abae97523f57ad582cb3e (patch)
tree569898b20b2f4780e930fb62556097922c24bb09
parent565b7577d581f2cb01e98686e98864d114262298 (diff)
downloaddocs-c66ddc1d499595765d4abae97523f57ad582cb3e.tar.gz
Recommend against new View subclasses in Android API guidelines
PiperOrigin-RevId: 588882073 Change-Id: Id9ae298ad56408ea532d32c20690afd9bf166f62
-rw-r--r--api-guidelines/classes.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/api-guidelines/classes.md b/api-guidelines/classes.md
index 4499a5c..830b474 100644
--- a/api-guidelines/classes.md
+++ b/api-guidelines/classes.md
@@ -295,6 +295,18 @@ Classes that release resources through `close`, `release`, `destroy` or similar
methods should implement `java.lang.AutoCloseable` to allow developers to
automatically clean up these resources when using a `try-with-resources` block.
+### Avoid introducing new View subclasses in android.* <a name="classes-no-new-framework-views"></a>
+
+Do not introduce new classes that inherit directly or indirectly from
+`android.view.View` in the platform public API (i.e. in `android.*`).
+
+Android's UI toolkit is now [Compose-first](https://d.android.com/compose). New
+UI functionality exposed by the platform should be exposed as lower-level APIs
+that can be used to implement Jetpack Compose and optionally View-based UI
+components for developers in [androidx](http://go/androidx) libraries. Offering
+these components in androidx libraries affords opportunities for backported
+implementations when platform functionality is not available.
+
## Fields [F] <a name="fields"></a>
These rules are about public fields on classes.