Back to News for Developers

ELI5: Litho - Simplifying User Interface for Android

March 1, 2021ByDmitry Vinnik

In this post, we discuss Litho, a framework for building efficient User Interfaces (UI) for Android. If you're interested in watching a video on this topic, check out an episode of ELI5 series about this open source project on our Facebook Open Source YouTube channel.

Why Litho?

Most mobile applications today look pretty similar: endless scroll feeds of photos, videos and text. There are many moving pieces to make sure all the elements on your screen display correctly. Scrolling on mobile is a non-trivial problem with large apps. Think of the News Feed in the Facebook Android app - our developers put many engineering hours into making the scrolling a seamless experience, optimizing all possible states for the user. Fortunately, Litho can simplify solving this problem for you.

Litho is a declarative UI framework for Android. The framework brings UI components over to native Android development. This approach lets developers split their user interface into independent pieces, making testing, reusing and building new ones a lot easier. Litho allows developers to focus on implementing their ideas rather than on how their UI is structured. With Litho, developers only need to outline the layout, and the framework takes care of the rest.

The core principles of Litho are performance and scalability. Its asynchronous layout functionality allows Android apps to measure and process the UI ahead of time without blocking the UI thread, the main thread of the app execution.

Litho uses a Facebook open-source project, Yoga, which allows for a flat view hierarchy. This way, users of Litho get additional optimization in their scroll performance. If you want to learn more about Yoga, check out another ELI5 blog post.

Where is it used?

Litho was first released to the public in 2017. It has been used in many of Facebook’s Android apps like the Facebook App, Messenger, Facebook Lite and Workplace.

Where can I learn more?

To learn more about Litho, visit their website. It has documentation and tutorials to get you started with the project. If you want to engage with the community, you can join the Gitter channel or contact the team on Twitter.

If you would like to see more content about Litho, let us know on our YouTube channel, or tweet at us.

About the ELI5 series

In a series of short videos (~1 min in length), one of our Developer Advocates on the Facebook Open Source team explains a Facebook open source project in a way that is easy to understand and use.

We will write an accompanying blog post (like the one you're reading right now) for each of these videos, which you can find on our YouTube channel.

To learn more about Facebook Open Source, visit our open source site, subscribe to our YouTube channel, or follow us on Twitter and Facebook.

Interested in working with open source at Facebook? Check out our open source-related job postings on our career page by taking this quick survey.