I'm trying to understand how viewpager works by breaking down the source and I got to the dataSetChanged method. I got to the dataSetChanged method and within it is this piece of code.
if (needPopulate) {
// Reset our known page widths; populate will recompute them.
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
if (!lp.isDecor) {
lp.widthFactor = 0.f;
}
}
}
I was wondering what is it that getChildCount()
returns when it is called. I understand that it is a ViewGroup
method and returns all the children of the Viewgroup
calling the method but in this instance would the method return 1 for the FragmentStatePagerAdapter
that I will be adding or does it return the number of pages within my FragmentStatePagerAdapter
? What is the best way to find out?