The second Android 11 Developer Preview is now available, test it out and share your feedback.

Compose UI

Latest Update Current Release
April 1, 2020 0.1.0-dev08

Declaring dependencies

To add a dependency on Compose UI, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
    def ui_version = "0.1.0-dev08"

    implementation 'androidx.ui:ui-tooling:$ui_version'
    implementation 'androidx.ui:ui-layout:$ui_version'
    implementation 'androidx.ui:ui-material:$ui_version'

For more information about dependencies, see Add build dependencies.

Version 0.1.0-dev

Version 0.1.0-dev08

April 1, 2020

androidx.ui:ui-*:0.1.0-dev08 are released. Version 0.1.0-dev08 contains these commits.

API Changes

  • Added translationX/Y properties to support offseting the display list of drawing commands for a given Layer. This is useful to move content in response to animations or touch events. (I8641c)
  • Added pivotX, pivotY parameters to Layer APIs to support rotation and scaling around a particular point on a layer (Icf7c3)
  • Draggable has been moved to modifier (Id9b16, b/151959544)
  • Moved Text to the package, from androidx.ui.core. (I87ce5)
  • Added enabled param to Checkbox, Switch and Toggleable (I41c16)
  • Ripple is now a Modifier. While Clickable is not yet converted the recommended usage is Clickable(onClick = { ... }, modifier = ripple()) (Ie5200, b/151331852, b/150060763)
  • Added VectorPainter API to replace existing subcomposition API for vector graphics. The result of subcomposition is a VectorPainter object instead of a DrawModifier.
    • Deprecated the previous DrawVector composables in favor of VectorPainter.
    • Renamed Image(Painter) API to PaintBox(Painter)
    • Created Vector composable that behaves like the Image composable except with a VectorAsset instead of an ImageAsset (I9af9a) (b/149030271)
  • ParentData composable is deprecated. You should either create a modifier which implements the ParentDataModifier interface, or use the LayoutTag modifier if you simply need to tag layout children to recognize them inside the measure block. (I51368, b/150953183)
  • OnPositioned was removed in favor of the onPositioned modifier (I2ea3c)
  • RowScope and ColumnScope members are now accessible outside Row and Column. (I3a641)
  • Container has been deprecated. Use Box instead. (I675ce, b/151407926)
  • Refactored FloatingActionButton APIs to accept composable lambdas instead of primitives. See updated samples for usage information. (I00622)
  • New functions: savedInstanceState() and rememberSavedInstanceState(). They are similar to state() and remember() but have a saved instance state support build in (If1987, b/152025209)

Bug Fixes

  • Replaced Modifier plus operator with factory extension functions (I225e4)
  • Deprecated Center composable. It should be replaced either with the LayoutSize.Fill + LayoutAlign.Center modifier, or with one of the Box or Stack composables with suitable modifiers applied (Idf5e0)
  • Changed MaterialTheme APIs such as MaterialTheme.colors(), MaterialTheme.typography() to be properties instead of functions. Removed the parentheses from existing calls and no behavioral change is expected. (I3565a)

Version 0.1.0-dev07

March 18, 2020

androidx.ui:ui-*:0.1.0-dev07 is released. Version 0.1.0-dev07 contains these commits.

API Changes

  • API additions to ManualAnimationClock: hasObservers: Boolean and constructor parameter dispatchOnSubscribe: Boolean (Iaa134)
  • Add OnPositionedModifier and OnChildPositionedModifier to replace OnPositioned and OnChildPositioned composable functions. (I2ec8f)
  • Added LayerModifier, a modifier that allows adding a RenderNode for a Layout. It allows setting clipping, opacity, rotation, scaling, and shadows. This will replace RepaintBoundary. (I7100d, b/150774014)
  • Made the layout direction be propagated from parent layout node to children. Added layout direction modifier. (I3d955)
  • Created Image composable to handle sizing/layout in addition to drawing a given ImageAsset to the screen. This composable also supports drawing any arbitrary Painter instance respecting its intrinsic size as well as supporting a given fixed size or minimum size (Ibcc8f)
  • Renamed Image to ImageAsset to better differentiate the difference between the Image data and the upcoming Image composable used to participate in layout and draw content. (Id5bbd)
  • Created extension method on, Bitmap.asImageAsset(), to create an instance of an ImageAsset useful for combining traditional Android application development with the compose framework. (Id5bbd)
  • androidx.compose.ViewComposer has been moved to androidx.ui.node.UiComposer and androidx.compose.Compose.subcomposeInto has moved to androidx.ui.core.subcomposeInto (Idef00)
  • Removed the Layout Composable function that accepts a varargs of children. (I8f7f6)
  • WithConstraints got LayoutDirection parameter (I6d6f7)
  • Added the LayoutOffset modifier for offsetting layout position (I0b8a3)
  • Surface and Card were moved from androidx.ui.material.surface to androidx.ui.material (I88a6d) (b/150863888)

Bug Fixes

  • Renamed LayoutFlexible to LayoutWeight. Renamed tight parameter to fill. (If4738)
  • The Opacity composable function has been replaced with the drawOpacity modifier. (I5fb62)
  • Tests using AndroidComposeTestRule now provide an animation clock at the root of the composition that allows it to be paused, resumed and advanced manually. (Id54c5)
  • Removed RepaintBoundary in favor of DrawLayerModifier (I00aa4)
  • Button, FloatingActionButton and Clickable now have a separate enabled param. Some of the params on Button were renamed or reordered. (I54b5a)
  • DrawVector has been changed from a regular composable function to returning a Modifier drawVector() that will draw the vector as a background to a layout. (I7b8e0)
  • Replace composable function Clip with modifier drawClip(). DrawClipToBounds is a convenient modifier to use when you only need to clip to the layer bounds with a rectangle shape. (If28eb)
  • Replaced DrawShadow composable function with drawShadow() modifier. Shadows are now drawn as part of LayerModifier. (I0317a)
  • Deprecated Wrap composable. It can be replaced either with the LayoutAlign modifier or with the Stack composable (Ib237f)
  • Renamed Painter.toModifier to Painter.asModifier as the newly created Modifier has a reference to the original Painter that can be shared across multiple Modifier instances (I7195b)
  • Negative padding in LayoutPadding is now disallowed. LayoutOffset should be used instead for negative position offsets. (Ifb5b1)

Version 0.1.0-dev06

March 4, 2020

androidx.ui:ui-*:0.1.0-dev06 is released. Version 0.1.0-dev06 contains these commits.

API Changes

  • Stack component supports right-to-left directionality (Ic9e00)
  • Initial support for Rtl in Compose layout (Ia5519)
  • Added Icon, IconButton and IconToggleButton, removing AppBarIcon. You can directly replace existing usages of AppBarIcon with IconButton, and they will now have the correct touch target. See the samples for usage information, and see Icons for the provided Material Icons you can use directly with these components. (I96849)
  • Removed Snackbar API with String parameters in favour of using the overload that accepts composable lambdas. See updated samples for usage information (I55f80)
  • Refactored Tab APIs to accept text and icon lambdas, (Ia057e)
  • Added BottomNavigation component, see the docs and samples for usage information (I731a0)
  • Adds support for calling custom semantics actions. (I8c818)

Bug Fixes

  • Support right-to-left direction in LayoutPadding modifier (I9e8da)

Version 0.1.0-dev05

February 19, 2020

androidx.ui:ui-*:0.1.0-dev05 is released. Version 0.1.0-dev05 contains these commits.

API Changes

  • Added Painter API. Created API to abstract drawing of content into a specified region. This behaves similar to the Drawable APIs however provides a more simplified API surface. Additionally there are generic implementations for applying various effects such as alpha and applying ColorFilters for arbitrary drawing implementations with the ability for the implementations themselves to provide a more optimized support for these facilities. (aosp/1214802)
  • Breaking changes to the ambients API. See log and Ambient<T> documentation for details (I4c7ee, b/143769776)
  • Changed LayoutCoordinates to make providedAlignmentLines a Set instead of a Map and have LayoutCoordinates implement the get() operator instead for retrieving a value. This makes it easier for modifiers to modify one or more value of the set without creating a new collection for each modifier. (I0245a)
  • LayoutCoordinates no longer has a position property. The position property does not make sense when considering LayoutModifiers, rotation, or scaling. Instead, developers should use parentCoordinates and childToLocal() to calculate the transform from one LayoutCoordinate to another.
  • LayoutCoordinates uses IntPxSize for the size property instead of `PxSize . Layouts use integer pixel sizes for layouts, so all layout sizes should use integers and not floating point values. (I9367b)
  • Added AdapterList, a scrolling list component that only composes and lays out the visible items. Currently known issues include that it is vertical-only and does not fully handle all cases of changes to its children. (Ib351b)
  • Add initial support for embedding Android Views inside Compose. Please see the ViewInCompose.kt demo for more details. (I6d1ce)
  • Updated LayoutAlign to not fill the available space anymore (I2b14f)
  • Added androidx.ui:ui-material-icons-core and androidx.ui:ui-material-icons-extended modules. You can depend on androidx.ui:ui-material-icons-extended to be able to directly use all Material icons ( from inside Compose. A small (currently three, will be expanded in the future) subset including the most commonly used icons will be directly included as part of the main ui-material library, so you won’t need to add this large dependency to use icons such as Menu. See androidx.ui.material.icons.Icons documentation for more information, and the linked samples.
  • Removed AspectRatio composable in favor of modifier. Deleted obsolete FlexColumn, FlexRow composables and Spacing modifier (Iec8a7)
  • Replaced ButtonStyle with distinct functions and removed text (string) overload. See updated Button samples for usage information. (If63ab, b/146478620, b/146482131)

Bug Fixes

  • Density and DensityScope were merged into one interface. Instead of ambientDensity() you can now use DensityAmbient.current. Instead of withDensity(density) just with(density) (I11cb1)

Known Issues

  • Changes to a component's semantic properties incorrectly cause all state in children to be lost, causing breakages in animations and anything else that relies on state being persisted across recompositions. Because lambdas cannot currently be compared, this includes any components that define a semantic action using a non-remembered lambda, such as Scroller. This will be fixed in the next release. (b/148606417)

Version 0.1.0-dev04

January 29, 2020

androidx.ui:ui-*:0.1.0-dev04 is released. The commits included in this version can be found (here).

API Changes

  • Make pointer ids universally unique. (I42cde)
  • Semantics node merging (aosp/1138236)
  • Improvements to the API surface of Constraints (I0fd15)
  • Refactored the PathParser and PathNode/PathCommand (I715ae)
  • Update API surface of DpConstraints (I712a0)
  • Added support for modifiers that implement multiple interfaces. (I22c16)
  • Implemented cancel for the remainder of the gesture detectors. (I349f4)
  • Added Color.compositeOver() to Color (I5379d)
  • Remove a few unneeded classes for androidx.ui:ui-core: ImageByteFormat, ImageRepeat, Matrix2. (I45e6b)
  • Enabled incremental Kotlin compilation in Compose projects (b/144304390)
  • Concatenate Modifiers with + (Ic33d3)
  • Added LayoutTag modifier (I69fe4)
  • Add ParagraphStyle attributes to TextStyle (If0d40)
  • Added DrawModifier, a modifier type that is allowed to draw on the surface of the modified layout. (I5fa56)
  • Change storage for the modifier position to be relative. (I5977f)
  • Added testing API to perform swipes on elements (I9125a)
  • Added Box component for combining layout and drawing common functionality. (I6e2a7)
  • Scrollers now exhibit native Android fling motion behavior. (b/147493715)
  • Replaced DrawBorder in favor of Border Modifier (Id335a)
  • Improved Scroller gesture detection. (I87d36)
  • Adds contentColor metadata to foundation (Icd074)
  • Scaffold material component has been added. Scaffold implements the basic material design visual layout structure. (I7731b)
  • Use new Surface's param contentColor in Buttons (b/146210556)
  • Removed textStyle.withOpacity() (I8cc9a)
  • Adds Emphasis subsystem (Ife95c)
  • FloatingActionButtonKt FAB properties are now private (I9c121)
  • Implemented the first iterations of a Snackbar (If1c08)
  • Added initial support for dark theme (I6323a)
  • Added size, center, and localToGlobal to GestureScope (I1ea37)
  • Add API for injection of double click gesture (I44902)
  • Added sendLongClick methods to GestureScope (Ic7db9)
  • Convert (x, y) to PxPosition in gesture injection (Ifefa4)
  • Added desired velocity to injected gesture (I3b9df)
  • Added bitmap capturing into Compose test API (androidx.ui:ui-test). (I4e36c)
  • Moved doClick to GestureScope (I56211)
  • Added findBySubstring and corresponding filters to FindersKt. (Ief0b9)
  • Refactored Text Selection Bounding To 1 Char. (Iff757)
  • Removed TextSpan (Iebece)
  • Remove Composition classes in favor of Composer base class (Ieadbf)
  • Changed Vector defaultWidth/defaultHeight to use Dp (Iad267)
  • Correctly generate groups around inline composable calls (Ibf739)
  • Enabled flag prototyping in Gesture Detectors. (I4b7b0)
  • Change maxLines and ellipsis argument from nullable to non-null (I46dac)
  • AnnotatedString now uses SpanStyle (Ib6d3e)
  • Added modifiers support for WithConstraints (b/145399789)
  • Pass paragraph style to TextDelegate (Id2d4a)
  • Added SpanStyle class (Ifdb4f)
  • Use default value instead of nullable Float in TextGeometricTransform. (I1bf00)
  • Added PreviewActivity to androidx.ui:ui-tooling (Ic8988)
  • ModelObserver is now single-threaded. (b/146144712)
  • Added benchmark for ModelObserver (Ia176b)
  • Call cancel callbacks when the PointerInputNode is removed from the tree. (I7112a)
  • Removed the LayoutInflexible modifier for Row and Column (I0d820)
  • Inherit layout modifiers from ParentDataModifier (I49b6a)
  • Added Wrapped modifier (I6f8df)
  • Added Aligned modifiers (Ifc581)
  • Added Constraint Layout to Compose (I175ad)


  • Moved graphics from androidx.ui:ui-core to androidx.ui:ui-graphics. (Ic17b0)
  • Changed module and package of Dp, IntPx, etc to androidx.ui:ui-unit and androidx.ui:ui-util. (I45fe4)
  • Refactor effects to @Composable (Ie2686)