Recyclerview Changing Items During Scroll

前端 未结 15 713
我在风中等你
我在风中等你 2020-11-27 10:38

I have a RecyclerView. Each row has a play button, textview and Progressbar. when click on the play button have to play audio from my sdcard and have to progress Progressbar

15条回答
  •  一生所求
    2020-11-27 11:25

    When we are changing RecyclerView items dynamically (i.e. when changing background color of a specific RecyclerView item), it could change appearance of the items in unexpected ways when scrolling due to the nature of how RecyclerView reuse its items.

    However to avoid that it is possible to use android.support.v4.widget.NestedScrollView wrapped around the RecyclerView and letting the NestedScrollView handle the scrolling.

    
    
        
    
            
    
       
    
    

    And then in the code you can disable nested scrolling for the RecyclerView to smooth out scrolling by letting only the NestedScrollView to handle scrolling.

    ViewCompat.setNestedScrollingEnabled(recyclerView, false);
    

提交回复
热议问题