This was an old question of mine. A bounty was placed on it, hence the surge of popularity and the multiple new and irrelevant answers.
As stated in both my comment to this answer and @CQM's comment below my original question, the answer is to override the onViewRecycled()
method and perform any needed operations there. This method is called when a view is recycled, and any cleanup operations can be done here.
Documentation on this method can be found here.
In my case, it was a matter of deleting the invisible TextView
's attached to the view. The text itself had been deleted, but the view remained. If many invisible TextView
's accumulate on the view and aren't properly recycled when scrolling, the scroll will begin to lag.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…