本文整理汇总了Java中android.widget.TabWidget.getDescendantFocusability方法的典型用法代码示例。如果您正苦于以下问题:Java TabWidget.getDescendantFocusability方法的具体用法?Java TabWidget.getDescendantFocusability怎么用?Java TabWidget.getDescendantFocusability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TabWidget
的用法示例。
在下文中一共展示了TabWidget.getDescendantFocusability方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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();
}
}
示例2: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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);
// 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();
}
}
示例3: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
/**
* 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);
}
示例4: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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);
}
示例5: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
TabWidget widget = mTabHost.getTabWidget();
int oldFocusability = widget.getDescendantFocusability();
widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
mTabHost.setCurrentTab(position);
widget.setDescendantFocusability(oldFocusability);
Log.i("zyw", ">>>>>>onPageSelected, position=" + position);
}
示例6: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
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);
}
示例7: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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);
}
示例8: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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);
widget.setStripEnabled(true);
linearlayouts[position].setPressed(true);
mTabHost.setCurrentTab(position);
widget.setDescendantFocusability(oldFocusability);
}
示例9: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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.
NLog.d(TAG, "onPageSelected:" + position);
TabWidget widget = mTabHost.getTabWidget();
int oldFocusability = widget.getDescendantFocusability();
widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
offset = position / MAX_TAB * MAX_TAB;
NLog.d(TAG, "onPageSelected current offset=" + offset);
if (offset + MAX_TAB > pageCount && offset > 0) {
offset = pageCount - MAX_TAB;
NLog.i(TAG, "onPageSelected current offset=" + offset);
}
TextView v = null;
for (int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) {
v = (TextView) mTabHost.getTabWidget().getChildAt(i);
v.setText(String.valueOf(i + offset + 1));
}
mTabHost.setCurrentTab(position - offset);
widget.setDescendantFocusability(oldFocusability);
}
示例10: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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);
}
示例11: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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);
}
示例12: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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);
}
示例13: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
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);
}
示例14: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
@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 = th.getTabWidget( );
int oldFocusability = widget.getDescendantFocusability( );
widget.setDescendantFocusability( ViewGroup.FOCUS_BLOCK_DESCENDANTS );
th.setCurrentTab( position );
widget.setDescendantFocusability( oldFocusability );
}
示例15: onPageSelected
import android.widget.TabWidget; //导入方法依赖的package包/类
public void onPageSelected(int position) {
TabWidget widget = tabHost.getTabWidget();
int oldFocus = widget.getDescendantFocusability();
widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
tabHost.setCurrentTab(position);
widget.setDescendantFocusability(oldFocus);
}