public int getCurrentTab() { int index = -1; int size = tabs.size(); View page = adapter.getItem(pager.getCurrentItem()); for (int i = 0; i < size; i++) { Pair<View, View> tab = tabs.get(i); if (tab.second == page) { index = i; break; } } return index; }
@Override public void onPageSelected(int position) { View page = adapter.getItem(position); int tab_size = tabs.size(); for (int index = 0; index < tab_size; index++) { Pair<View, View> tab = tabs.get(index); if (page == tab.second) { setCurrentTab(index); // TODO denan.wang; 2015/2/13; if (page instanceof Pageable) { ((Pageable) page).onSelected(TabController.this); } // END // TODO denan.wang; 2015/2/13; if (listener != null) { listener.onTabChanged(TabController.this); } // END return; } } clearItemState(); }