Code example for TabWidget

Methods: getDescendantFocusabilitysetDescendantFocusability

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) {
        } 
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE