Facebook open-sources framework for smoother Android apps
Facebook is open-sourcing its Litho framework for smooth UI performance on Android mobile applications.
The framework supports native development and leverages the declarative model used in Facebook's React UI library and the Yoga layout system. Layout operations are decoupled from Android views, which "allows us to move the CPU-intensive measure and layout operations to the background thread, saving milliseconds," said Facebook software engineers Pasquale Anatriello and Marco Cova.
Litho's declarative API frees developers from having to hand-optimize UIs, the engineers said. Components are laid out ahead of time in a background thread and rendered incrementally to improve performance. Facebook already has had a similar offering for Apple iOS mobile development with its ComponentKit framework.
Through Litho, complex views are broken down into smaller pieces, such as text, images, and videos, and are rendered incrementally. This spreads the work across multiple frames and recycles smaller pieces that can be recombined, thus reducing the number of views that have to be created and stored in memory. "Since being used across our apps, Litho has delivered great results, including an improvement in scroll performance of up to 35 percent, better memory behavior with complex lists, and easier-to-test UI code," the engineers said.
Android has addressed rendering and dynamic scrolling through the RecyclerView UI container, which can recycle views, Facebook engineers said. But RecyclerView keeps views in different pools, depending on their type. This results in more views being held in memory while new views are constantly created, affecting memory and performance. A view-flattening capability in Litho reduces the number of views needing to be displayed and saves on memory.
- latest news
- Siri adds 'hero' to capabilities after saving fishermen
- Stamps change with heat to create total eclipse of the mail
- Apple's competitor to Venmo could be on the way
- Astronaut snaps unreal sunset spacecraft photo
- Uber partners with Dallas and Dubai to usher in flying cars
- OK, Google, let's put the new voice ID everywhere
- Forget Apple Pay. Mastercard made a biometric credit card
- Web Design Trends for 2017
- Why Are Long-Scroll Pages Problematic?
- Snapchat has made its stories searchable