Java Code Examples for android.widget.TabWidget#getDescendantFocusability()
The following examples show how to use
android.widget.TabWidget#getDescendantFocusability() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TabsAdapter.java From fdroidclient with GNU General Public License v3.0 | 6 votes |
@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. // 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); // Scroll the current tab into visibility if needed. View tab = widget.getChildTabViewAt(position); tempRect.set(tab.getLeft(), tab.getTop(), tab.getRight(), tab.getBottom()); widget.requestRectangleOnScreen(tempRect, false); // Make sure the scrollbars are visible for a moment after selection final View contentView = tabs.get(position); if (contentView instanceof CaffeinatedScrollView) { ((CaffeinatedScrollView) contentView).awakenScrollBars(); } }
Example 2
Source File: HelpFragment.java From RobotCA with GNU General Public License v3.0 | 5 votes |
/** * Callback for when a tab is selected. * @param position The position of the selected tab */ @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. // 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); }
Example 3
Source File: TabsAdapter.java From mytracks with Apache License 2.0 | 5 votes |
@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. 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); }
Example 4
Source File: FragmentTabsPager.java From V.FlyoutTest with MIT License | 5 votes |
@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. // 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); }
Example 5
Source File: TabsAdapter.java From callerid-for-android with GNU General Public License v3.0 | 5 votes |
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. // 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); }