简体   繁体   中英

How “heavy” is android's recyclerview?

If I have a custom autocomplete fragment, in which I repeatedly destroy the contents and refill it with (at most 6) text views, as the user types a string.

Currently I'm using a LinearLayout for the text views, but I was considering using a RecyclerView for this. I'm unsure if this is really necessary though, given the fact that I have:

At most 6 text views in the dropdown and I expect the user to type ~ 5 characters before submitting or choosing an autocomplete item.

So the question is: Will there be a performance difference between the two? Should I bother changing from LinearLayout to RecyclerView?

See, any how recyclerview is better because it reuses the itemview for displaying the list. And in future , if we add more items, just add the items,to the array lisy, it will do all the task automatically.

I don't think there will be a better performance using recyclerview. Since you only have 6 fixed textviews to deal with, there is no reason to switch.

recyclerview's performance boost comes to having super long lists while updating, adding, removing its data on runtime. Otherwise there's no difference.

Why not use AutoCompleteTextView ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM