Litho: A declarative UI framework for Android

Litho is a declarative framework for building efficient user interfaces (UI) on Android. It allows you to write highly-optimized Android views through a simple functional API based on Java annotations. It was primarily built to implement complex scrollable UIs based on RecyclerView.

With Litho, you build your UI in terms of components instead of interacting directly with traditional Android views. A component is essentially a function that takes immutable inputs, called props, and returns a component hierarchy describing your user interface.

class HelloComponentSpec {

  static ComponentLayout onCreateLayout(
      ComponentContext c,
      @Prop String name) {

    return Text.create(c)
        .text("Hello, " + name)
        .paddingDip(ALL, 10)

You simply declare what you want to display and Litho takes care of rendering it in the most efficient way by computing layout in a background thread, automatically flattening your view hierarchy, and incrementally rendering complex components.

Have a look at our Tutorial for a step-by-step guide on using Litho in your app. You can also read the quick start guide on how to write and use your own Litho components.