Annotation Interface ModelView


@Target(TYPE) @Retention(CLASS) public @interface ModelView
An annotation on custom view classes to automatically generate an EpoxyModel for that view. Used in conjunction with ModelProp

See https://github.com/airbnb/epoxy/wiki/Generating-Models-from-View-Annotations

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Use with autoLayout() to declare what layout parameters should be used to size your view when it is added to a RecyclerView.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    If set to an option besides ModelView.Size.NONE Epoxy will create an instance of this view programmatically at runtime instead of inflating the view from xml.
    An optional EpoxyModel subclass to use as the base class of the generated view.
    int
    The layout file to use in the generated model to inflate the view.
    boolean
    True to have the generated model take up the total available span count.
    boolean
    Whether the model should save view state when unbound.
  • Element Details

    • autoLayout

      ModelView.Size autoLayout
      If set to an option besides ModelView.Size.NONE Epoxy will create an instance of this view programmatically at runtime instead of inflating the view from xml. This is an alternative to using defaultLayout(), and is a good option if you just need to specify layout parameters on your view with no other styling.

      The size option you choose will define which layout parameters Epoxy uses at runtime when creating the view.

      Default:
      NONE
    • defaultLayout

      @LayoutRes int defaultLayout
      The layout file to use in the generated model to inflate the view. This is required unless a default pattern is set via PackageModelViewConfig or autoLayout() is used.

      Overrides any default set in PackageModelViewConfig

      Default:
      0
    • baseModelClass

      Class<?> baseModelClass
      An optional EpoxyModel subclass to use as the base class of the generated view. A default can also be set with PackageModelViewConfig

      * Overrides any default set in PackageModelViewConfig

      Default:
      java.lang.Void.class
    • saveViewState

      boolean saveViewState
      Whether the model should save view state when unbound.

      see: EpoxyModel#shouldSaveViewState

      Default:
      false
    • fullSpan

      boolean fullSpan
      True to have the generated model take up the total available span count. False to instead use a span count of 1. If you need to programmatically determine your model's span size you can use the spanSizeCallback method on EpoxyModel.
      Default:
      true