xaverkapeller / SortedListAdapter

The RecyclerView.Adapter that makes your life easy!
https://wrdlbrnft.github.io/SortedListAdapter/
MIT License
49 stars 13 forks source link

Bind to diffrent R.layout.example.xml #2

Closed romansigrist closed 7 years ago

romansigrist commented 7 years ago

Hi! I'm not familiar with DataBinding. How can i bind to diffrent xml layouts? Normally i can change the layout xml in the onCreateViewHolder function: inflater.inflate(R.layout.example, parent, false); How can i change the ViewType and the ViewHolder based on the Model.getName() function or other criteria? I'm very open for good suggestions. Thx for your help.

xaverkapeller commented 7 years ago

I'm not sure what you are asking about. You don't have to use Data Binding with the SortedListAdapter. If you are uncomfortable with it, you can still inflate a view like usual and do all the data binding yourself. If you want to learn more about the Android Data Binding Library start here: https://developer.android.com/topic/libraries/data-binding/index.html

romansigrist commented 7 years ago

Yes, i think i let it go for the moment. All i see in the onCreateViewHolder is:

final ModelBinding binding = ModelBinding.inflate(inflater, parent, false);
return new FilesHolder(binding, mListener);

And out of nowhere the ActivityMainBinding is broken again. Thx for your reply.