當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。