0

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.

Dmitrijs
  • 1,333
  • 1
  • 14
  • 20

1 Answers1

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