Annotation Type 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

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      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.
      java.lang.Class<?> baseModelClass
      An optional EpoxyModel subclass to use as the base class of the generated view.
      int defaultLayout
      The layout file to use in the generated model to inflate the view.
      boolean fullSpan
      True to have the generated model take up the total available span count.
      boolean saveViewState
      Whether the model should save view state when unbound.
    • Element Detail

      • 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:
        com.airbnb.epoxy.ModelView.Size.NONE
      • baseModelClass

        java.lang.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