4

I try to create Epoxy ModelView according to their Wiki documentation. I am getting this error: "Epoxy Processor Exception: Unable to get layout resource for view TitleModel"

This is my Java code:

import ...
@ModelView
public class ModelViewA extends LinearLayout{
    private TextView titleTextView;
    @TextProp String title;
    @CallbackProp @Nullable View.OnClickListener clickListener;

    public ModelViewA(Context context) {
        super(context);
        inflate(getContext(), R.layout.title, this);
        titleTextView = findViewById(R.id.title_text_view);
    }

    @AfterPropsSet
    void postBindSetup() {
        titleTextView.setText(title);
        titleTextView.setOnClickListener(clickListener);
    }
}
Mantaz
  • 333
  • 1
  • 4
  • 12

2 Answers2

1

You have to put a PackageConfig interface in your Model class package:

package com.example;

import com.airbnb.epoxy.PackageModelViewConfig;
import com.example.R;

@PackageModelViewConfig(rClass = R.class)
public interface PackageConfig {}
qwertyfinger
  • 634
  • 7
  • 16
0

You have to define an autoLayout or defaultLayout.

@ModelView(autoLayout = Size.MATCH_WIDTH_WRAP_HEIGHT)
public class MyView extends FrameLayout {
   ...
}

Source

Ali Rezaiyan
  • 3,011
  • 3
  • 16
  • 27