Jetpack compose

Original author:
  • Transfer


  • Jetpack Compose is a stand-alone toolkit designed to simplify UI development. It combines the reactive programming model with the conciseness and ease of use of the Kotlin programming language
  • NOTE: Jetpack Compose is currently in the early stages of pre-alpha research. Its API is not yet complete and therefore should not be used in production

  • from a translator: at the bottom of the article is a link to a video report on Jetpack Compose at the Google I / O'19 Conference

Basic principles

Kotlin brevity and style

  • takes advantage of Kotlin - concise, secure, and fully compatible with Java. Designed to significantly reduce the amount of standard code, which allows you to focus on your code, and helps to avoid internal class errors


  • Fully declarative definition of UI components, including rendering and creating custom layouts. It simply describes your UI as a set of composable functions, and the platform controls the optimization of the UI and automatically updates the widget hierarchy


  • compatible with existing widgets so that you can mix and combine, as well as adapt as you need having direct access to all Android and Jetpack APIs

Allows you to create beautiful applications

  • supports Material Design out of the box, as well as animation, so it makes it easy to create beautiful applications filled with movement

Speeds up development

  • Speed ​​up development by writing less code and using tools similar to Apply Changes and by viewing changes in real time

Quick review

  • Jetpack Compose is powered by the Android Open Source Project . It contains two main components:
    • Compose UI library, which contains the main UI toolkit i.e. markup, input fields, text fields, animations, styles, widgets and graphics
    • Compose compiler, native Kotlin-compiled plugin containing layout functions and automatically updating the UI hierarchy
  • A compose application consists of composable functions that transform application data into a UI hierarchy. Functions are all you need to create a new UI component.
  • to create a composable function, simply add the @Composable annotation to the function name. Under the hood, Compose uses its own Kotlin-compiled plugin so that when background data changes, composable functions can be called repeatedly to generate updates to the UI hierarchy. A simple example below prints a line on the screen:

    import androidx.compose.*
    import androidx.ui.core.*
    fun Greeting(name: String) {
        Text ("Hello $name!")

  • The library API is located in the AOSP directory at frameworks / support / ui . Compose compiler and runtime code are available at the following frameworks / support / compose link

Compose UI Library

  • The Jetpack Compose UI library contains the following modules:
    • android-text / - Android-specific text implementations
    • android-view / - wrappers and adapters for existing Android widgets
    • animation / - animation components
    • animation-core / - internal components of the animation system
    • core / - base classes of the system including primitives, graphics and drawing
    • framework / - the basic components provided by the system, used as building blocks. Contains the classes Draw, Layout, Text, etc.
    • layout / - basic layout components
    • material / - a set of UI components created taking into account the Material Design specification
    • platform / - internal implementations allowing to separate Android-implementation from tests on the host side
    • test / - testing the framework
    • text / - text engine

From translator

Video talk with Jetpack Compose on Google I / O'19

Only registered users can participate in the survey. Please come in.

How painful is it to develop a UI for Android now?

  • 12.9% Very Painful 27
  • 16.8% It just hurts 35
  • 47.1% Tolerant 98
  • 23% Nothing hurts 48

Also popular now: