Я изучаю StackView и AdapterViewAnimator. И обнаружил, что в AdapterViewAnimator, он НЕ удаляет детей напрямую, , но помещает их в массив, и удаляет на следующей фазе.Почему AdapterViewAnimator удаляет детей в 2 этапа?
Не могли бы вы объяснить, в чем причина этого дизайна? Почему я не могу просто удалить их напрямую?
больше информации: Я также заметил, что из-за выше конструкции, StackView (который расширяет AdapterViewAnimator) будет иметь некоторые дети задерживаются на ... И заставить меня хотите спросить, почему.
Дополнительная информация: ниже фрагмент кода, который я упоминал выше: (от AdapterViewAnimator.showOnly (целое, булево))
// This section clears out any items that are in our active views list
// but are outside the effective bounds of our window (this is becomes an issue
// at the extremities of the list, eg. where newWindowStartUnbounded < 0 or
// newWindowEndUnbounded > adapterCount - 1
for (Integer index : mViewsMap.keySet()) {
boolean remove = false;
if (!wrap && (index < rangeStart || index > rangeEnd)) {
remove = true;
} else if (wrap && (index > rangeEnd && index < rangeStart)) {
remove = true;
}
if (remove) {
View previousView = mViewsMap.get(index).view;
int oldRelativeIndex = mViewsMap.get(index).relativeIndex;
mPreviousViews.add(index);
transformViewForTransition(oldRelativeIndex, -1, previousView, animate);
}
}
Спасибо. BR, Henry