ViewHolder模式改善的ListView滚动帧率,如在下面的例子所示: https://开头开发商。 android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html

时有可能保持这种模式,同时使用不同种类的浏览次数为不同行的?

在换句话说,是有可能这样做:

 public View getView(int position, View view, ViewGroup parent) {  
     // calculate viewID here
     if (view == null || *view is not null but was created from different XML than viewID* ) { 
         view = mInflater.inflate(viewId, null);  
有帮助吗?

解决方案

是的,尽管它远不如覆盖getViewTypeCount()getItemViewType()在您的适配器。这会教Android的对象池只手就行早在getView()适当类型的。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top