Code example for TabHost

Methods: getTabWidgetsetCurrentTab

0
        } 
 
        @Override 
        public void onPageSelected(int position) {
            // ViewPagerのViewがスワイプで切り替わったら 
            TabWidget widget = mTabHost.getTabWidget();
            int oldFocusability = widget.getDescendantFocusability();
            widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
            // タブも切り替える 
            mTabHost.setCurrentTab(position);
            widget.setDescendantFocusability(oldFocusability);
        } 
 
        @Override 
        public void onPageScrollStateChanged(int state) {
        } 
    } 
}