コード例 #1
0
 public void notifyDataSetChanged() {
   mIconsLayout.removeAllViews();
   com.viewpagerindicator.IconPagerAdapter iconAdapter =
       (com.viewpagerindicator.IconPagerAdapter) mViewPager.getAdapter();
   int count = iconAdapter.getCount();
   for (int i = 0; i < count; i++) {
     ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);
     view.setImageResource(iconAdapter.getIconResId(i));
     mIconsLayout.addView(view);
   }
   if (mSelectedIndex > count) {
     mSelectedIndex = count - 1;
   }
   setCurrentItem(mSelectedIndex);
   requestLayout();
 }