Skip to main content

Overview

Primitive Components are used to render views or drawables and are a replacement for the old Specs API-based Mount Specs. Here, Mount refers to the operation performed by all components in a layout tree to extract their rendered state (a View or a Drawable) to be displayed.

Primitive Components should only be created when you need to integrate your own views/drawables with Litho.

The Primitive Components section contains the following pages:

  • Creating a Primitive Component - details how to create a Primitive Component responsible for rendering a View or Drawable. Also, compares Primitive Components with KComponents.
  • Lifecycle of a Primitive - covers the purpose and creation of a Primitive in addition to how to create and mount its content.
  • Measuring - shows different strategies to measure the content the Primitive Component will render.
  • Controllers Pattern - illustrates the use of controllers by implementing a simple TimePicker that shows an arbitrary time.
  • Content Pooling - details a strategy that can be used to populate the content pools to optimise first mount performance.
  • Tracing - shows how to customize performance tracing information for Primitive Components.

Information and step-by-step explanations of how to migrate existing MountSpec components to Primitive Components can be found in Migrating MountSpecs page.