public LoopScrollRect2LoopListView2(LoopListView2 lv, string poolName, int itemCount = 0, UnityAction <int> scrollRectIndexCallback = null) { if (listView == null) { this.poolName = poolName; listView = lv; scrollRect = lv.GetComponent <ScrollRect>(); LoopListViewInitParam initParam = LoopListViewInitParam.CopyDefaultInitParam(); ItemPrefabConfData data = lv.GetFirstItemPrefabConfData(); if (data != null) { Vector2 size = data.mItemPrefab.GetComponent <RectTransform>().sizeDelta; bool isVertList = (lv.ArrangeType == ListItemArrangeType.TopToBottom || lv.ArrangeType == ListItemArrangeType.BottomToTop); initParam.mItemDefaultWithPaddingSize = isVertList ? size.y : size.x; initParam.mItemDefaultWithPaddingSize += data.mPadding; } initParam.mDistanceForNew0 = 100; initParam.mDistanceForNew1 = 100; listView.InitListView(itemCount, OnGetItemByIndex, initParam); this.scrollRectIndexCallBack = scrollRectIndexCallback; } }