Skip navigation links
com.facebook.litho

Interface Mountable<ContentT>

    • Method Detail

      • getRenderType

        RenderUnit.RenderType getRenderType()
        Specifies if the content type is View or a Drawable.
        • This must be a constant.
        • Must not cause side effects.
        • Can be called from any thread.
        Returns:
        Returns RenderUnit.RenderType#VIEW or RenderUnit.RenderType#DRAWABLE.
      • createContent

        ContentT createContent(Context context)
        Creates new mountable content when called.
        • Must not cause side effects.
        • Called from the main thread.
        Parameters:
        context - The Android context.
        Returns:
        A new mountable content.
      • measure

        java.lang.Object measure(ComponentContext context,
                                 int widthSpec,
                                 int heightSpec,
                                 Size size,
                                 java.lang.Object previousLayoutData)
        Given a and set the width and height this Mountable will require in . In addition this method can return any data that is required to set, and unset properties on the content in the binders.

        If measure is called again in the same layout pass, then will be the layout data returned by the previous measure call.

        As a performance optimisation the framework will skip this method if this Mountable is equal to the previous Mountable, and if the size specs are compatible. In order to do this the framework will check if every field of the Mountable is equal using reflection. It is highly recommended to implement Equivalence to avoid using the reflection based equivalence check.

        • Must not cause side effects.
        • Is guaranteed to be called at least once.
        • Can be called more that once.
        • Can be called from any thread.