Example usage for android.widget TabWidget setDescendantFocusability

List of usage examples for android.widget TabWidget setDescendantFocusability

Introduction

In this page you can find the example usage for android.widget TabWidget setDescendantFocusability.

Prototype

public void setDescendantFocusability(int focusability) 

Source Link

Document

Set the descendant focusability of this view group.

Usage

From source file:com.android.firewall.ui.adapter.MainPagerAdapter.java

public void onPageSelected(int position) {
    TabWidget widget = tabHost.getTabWidget();

    int oldFocus = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

    tabHost.setCurrentTab(position);/*w  w  w  . j a v a2  s  .co m*/

    widget.setDescendantFocusability(oldFocus);
}

From source file:co.uk.alt236.restclient4android.adapters.RequestTabsAdapter.java

@Override
public void onPageSelected(int position) {
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);// w w w .  ja  va  2 s  .co  m
    widget.setDescendantFocusability(oldFocusability);
}

From source file:com.androidfactorem.visualcv.ui.adapter.FragmentTabAdapter.java

@Override
public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk./*ww  w.  ja  v a 2  s.  c  o m*/
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);
}

From source file:br.com.cybereagle.androidlibrary.ui.adapter.TabsAdapter.java

@Override
public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk.//from w w  w .  j a  v  a 2  s .  c  om
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = tabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    tabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);
}

From source file:org.altusmetrum.AltosDroid.TabsAdapter.java

public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk.//from   ww  w  .j a  v a  2  s .c  om
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);
}

From source file:com.github.mobile.ui.fragments.TabsAdapter.java

@Override
public void onPageSelected(final int position) {
    // unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk.//www .  j a  v  a2 s .co m
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    final TabWidget widget = mTabHost.getTabWidget();
    final int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);
}

From source file:com.yojiokisoft.yumekanow.adapter.MainPagerAdapter.java

/**
 * @see ViewPager.OnPageChangeListener#onPageSelected(int)
 *//*from  w w w .  j  a va 2  s.c  o  m*/
@Override
public void onPageSelected(int position) {
    TabWidget widget = mTabHost.getTabWidget();

    int oldFocus = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

    mTabHost.setCurrentTab(position);

    widget.setDescendantFocusability(oldFocus);
}

From source file:br.com.bioscada.apps.biotracks.TabsAdapter.java

@Override
public void onPageSelected(int position) {
    /*//from  www.  j a va 2 s . c  om
     * Unfortunately when TabHost changes the current tab, it kindly also takes
     * care of putting focus on it when not in touch mode. The jerk. This hack
     * tries to prevent this from pulling focus out of our ViewPager.
     */
    TabWidget tabWidget = tabHost.getTabWidget();
    int oldFocusability = tabWidget.getDescendantFocusability();
    tabWidget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    tabHost.setCurrentTab(position);
    tabWidget.setDescendantFocusability(oldFocusability);
}

From source file:com.jtechme.apphub.privileged.views.TabsAdapter.java

@Override
public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk.//  w w  w  . j  a v a  2s .com
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);

    // Scroll the current tab into visibility if needed.
    View tab = widget.getChildTabViewAt(position);
    mTempRect.set(tab.getLeft(), tab.getTop(), tab.getRight(), tab.getBottom());
    widget.requestRectangleOnScreen(mTempRect, false);

    // Make sure the scrollbars are visible for a moment after selection
    final View contentView = mTabs.get(position);
    if (contentView instanceof CaffeinatedScrollView) {
        ((CaffeinatedScrollView) contentView).awakenScrollBars();
    }
}

From source file:com.android.packageinstaller.TabsAdapter.java

@Override
public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk./*from w  w w.  j a  v  a 2s  .  c o m*/
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);

    // Scroll the current tab into visibility if needed.
    View tab = widget.getChildTabViewAt(position);
    mTempRect.set(tab.getLeft(), tab.getTop(), tab.getRight(), tab.getBottom());
    widget.requestRectangleOnScreen(mTempRect, false);

    // Make sure the scrollbars are visible for a moment after selection
    final View contentView = mTabs.get(position).view;
    if (contentView instanceof CaffeinatedScrollView) {
        ((CaffeinatedScrollView) contentView).awakenScrollBars();
    }
}