当前位置: 首页>>代码示例>>Java>>正文


Java TabWidget.setDescendantFocusability方法代码示例

本文整理汇总了Java中android.widget.TabWidget.setDescendantFocusability方法的典型用法代码示例。如果您正苦于以下问题:Java TabWidget.setDescendantFocusability方法的具体用法?Java TabWidget.setDescendantFocusability怎么用?Java TabWidget.setDescendantFocusability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.TabWidget的用法示例。


在下文中一共展示了TabWidget.setDescendantFocusability方法的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();
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:25,代码来源:TabsAdapter.java

示例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();
    }
}
 
开发者ID:CmDnoEdition,项目名称:fdroid,代码行数:25,代码来源:TabsAdapter.java

示例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);
}
 
开发者ID:mtbii,项目名称:RobotCA,代码行数:19,代码来源:HelpFragment.java

示例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);
}
 
开发者ID:Plonk42,项目名称:mytracks,代码行数:14,代码来源:TabsAdapter.java

示例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);
}
 
开发者ID:LonerJimmy,项目名称:DynamicHeadBg,代码行数:10,代码来源:MainActivity.java

示例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);
}
 
开发者ID:Cangol,项目名称:Cangol-uiframe,代码行数:13,代码来源:TabPageManager.java

示例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);
}
 
开发者ID:10211509,项目名称:maketaobao,代码行数:14,代码来源:MainOrderListFragment.java

示例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);
}
 
开发者ID:samuelhehe,项目名称:AppMarket,代码行数:16,代码来源:AtyHome2.java

示例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);
}
 
开发者ID:ymback,项目名称:NGA-CLIENT-VER-OPEN-SOURCE,代码行数:30,代码来源:TabsAdapter.java

示例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);
}
 
开发者ID:DerTeufel,项目名称:DevilTools,代码行数:14,代码来源:TabsAdapter.java

示例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);
}
 
开发者ID:webshrub,项目名称:citizen-complaint,代码行数:11,代码来源:CitizenComplaintHomeActivity.java

示例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);
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:12,代码来源:SessionLivestreamActivity.java

示例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);
}
 
开发者ID:candrews,项目名称:callerid-for-android,代码行数:13,代码来源:TabsAdapter.java

示例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 );
}
 
开发者ID:qauck,项目名称:qsysinfo,代码行数:15,代码来源:QSystemInfo.java

示例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);
}
 
开发者ID:dekrandroid,项目名称:android-in-sette-giorni,代码行数:11,代码来源:MainActivity.java


注:本文中的android.widget.TabWidget.setDescendantFocusability方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。