Force RecyclerView to redraw its items

后端 未结 9 1164
闹比i
闹比i 2021-02-02 06:45

Is there any way to redraw all items of RecyclerView?

I have some Themes (in style.xml) and after changing the theme, I need the RecyclerView t

相关标签:
9条回答
  • 2021-02-02 07:39

    The below lines of code did the trick for me

    recyclerview.swapAdapter(myAdapter,false);
    recyclerview.setLayoutManager(myLayoutManager);
    myAdapter.notifyDataSetChanged();
    
    0 讨论(0)
  • 2021-02-02 07:40

    Force RecyclerView to onCreateViewHolder or redraw its items #Kotlin

    This worked for me

    0 讨论(0)
  • 2021-02-02 07:41

    Resetting the Adapter worked for me, I called this inside onConfigChange

    myRecyclerView.setAdapter(myAdapter)
    
    0 讨论(0)
提交回复
热议问题