Skip to content

facebook/litho

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7acc85c · Apr 18, 2017
Apr 11, 2017
Apr 18, 2017
Apr 5, 2017
Apr 18, 2017
Apr 13, 2017
Apr 17, 2017
Apr 17, 2017
Apr 17, 2017
Apr 17, 2017
Apr 15, 2017
Apr 17, 2017
Apr 12, 2017
Apr 17, 2017
Apr 17, 2017
Apr 18, 2017
Apr 17, 2017
Apr 17, 2017
Apr 16, 2017
Apr 1, 2017
Apr 13, 2017
Apr 13, 2017
Apr 17, 2017
Mar 29, 2017
Apr 12, 2017
Mar 29, 2017
Mar 29, 2017
Apr 18, 2017
Apr 18, 2017
Apr 16, 2017
Apr 17, 2017
Apr 18, 2017
Apr 5, 2017
Apr 5, 2017
Apr 17, 2017

Litho CircleCI

Litho is a declarative framework for building efficient UIs on Android.

  • Declarative: Litho uses a declarative API to define UI components. You simply describe the layout for your UI based on a set of immutable inputs and the framework takes care of the rest.
  • Asynchronous layout: Litho can measure and layout your UI ahead of time without blocking the UI thread.
  • View flattening: Litho uses Yoga for layout and automatically reduces the number of ViewGroups that your UI contains.
  • Fine-grained recycling: Any component such as a text or image can be recycled and reused anywhere in the UI.

Learn how to use Litho in your project.
Get started with our tutorial.
Read more about Litho in our docs.

Installation

Litho can be integrated either in Gradle or Buck projects. Read our Getting Started guide for installation instructions.

Quick start

1. Initialize SoLoader in your Application class.

public class SampleApplication extends Application {
  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, false);
  }
}

2. Create and display a component in your Activity

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final ComponentContext context = new ComponentContext(this);

    final Component component = Text.create(context)
        .text("Hello World")
        .textSizeDip(50)
        .build();

    setContentView(LithoView.create(context, component));
}

Run sample

You can find more examples in our sample app.

To build and run (on an attached device/emulator) the sample app, execute

$ buck fetch sample
$ buck install -r sample

or, if you prefer Gradle,

$ ./gradlew :sample:installDebug

Contributing

For pull requests, please see our CONTRIBUTING guide.

See our issues page for ideas on how to contribute or to let us know of any problems.

Please also read our Coding Style and Code of Conduct before you contribute.

License

Litho is BSD-licensed. We also provide an additional patent grant.