Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用回收站视图时哪种方法更好?是为不同的视图使用不同的视图持有者,还是为其中定义了所有不同布局并适当处理布局的可见性的单一视图持有者更好?为什么指定的方法更好?
最好使用多个 ViewHolders。原因是更好的内存性能,因为您没有一堆未使用的字段,并且 ViewHolders 在其他地方的可重用性更好。
如果他们共享许多字段,您可以创建BaseViewHolder其他人继承的类。
BaseViewHolder