I have RecyclerView with Banner as a header view, I want it to have different layouts in landscape and portrait modes, how can I achieve this? Putting different layouts in "layout" and "layout-land" folders does not work, and onCreateViewHolder and onBindViewHolder are not called on orientation change.
Asked
Active
Viewed 102 times
0
-
In other words, how can I update first ViewHolder from onConfigurationChanged callback – Dmitrijs Feb 03 '16 at 15:13
-
Is your recyclerview in an activity? How are you populating the adapter and restoring the state of your fragment/activity? – Pedro Oliveira Feb 03 '16 at 15:19
1 Answers
0
That solved my problem:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (mAdapter != null && mAdapter.getItemCount() > 0) {
mAdapter.notifyItemChanged(0);
}
}

Dmitrijs
- 1,333
- 1
- 14
- 20