當前位置: 首頁>>代碼示例>>Java>>正文


Java TabWidget.getChildTabViewAt方法代碼示例

本文整理匯總了Java中android.widget.TabWidget.getChildTabViewAt方法的典型用法代碼示例。如果您正苦於以下問題:Java TabWidget.getChildTabViewAt方法的具體用法?Java TabWidget.getChildTabViewAt怎麽用?Java TabWidget.getChildTabViewAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TabWidget的用法示例。


在下文中一共展示了TabWidget.getChildTabViewAt方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: addTagToLastTab

import android.widget.TabWidget; //導入方法依賴的package包/類
/**
 * Last current tab is tagged with the given tabName
 * @param tabName
 */
private void addTagToLastTab(String tabName){
    TabWidget tabWidget=tabHost.getTabWidget();
    int numTabs=tabWidget.getTabCount();
    LinearLayout tabIndicator=(LinearLayout)tabWidget.getChildTabViewAt(numTabs - 1);

    ImageView imageView = (ImageView)tabIndicator.getChildAt(0);
    imageView.setTag(tabName);
}
 
開發者ID:EyeSeeTea,項目名稱:EDSApp,代碼行數:13,代碼來源:DashboardController.java

示例4: addTagToLastTab

import android.widget.TabWidget; //導入方法依賴的package包/類
private void addTagToLastTab(String tabName) {
    TabWidget tabWidget = tabHost.getTabWidget();
    int numTabs = tabWidget.getTabCount();
    ViewGroup tabIndicator = (ViewGroup) tabWidget.getChildTabViewAt(numTabs - 1);

    ImageView imageView = (ImageView) tabIndicator.getChildAt(0);
    imageView.setTag(tabName);
    TextView textView = (TextView) tabIndicator.getChildAt(1);
    textView.setGravity(Gravity.CENTER);
    textView.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
    textView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;

}
 
開發者ID:EyeSeeTea,項目名稱:pictureapp,代碼行數:14,代碼來源:DashboardActivity.java

示例5: setTargetView

import android.widget.TabWidget; //導入方法依賴的package包/類
public void setTargetView(TabWidget target, int tabIndex) {
    View tabView = target.getChildTabViewAt(tabIndex);
    setTargetView(tabView);
}
 
開發者ID:Gofar,項目名稱:TitleBar,代碼行數:5,代碼來源:BadgeView.java

示例6: setTargetView

import android.widget.TabWidget; //導入方法依賴的package包/類
public void setTargetView(TabWidget target, int tabIndex) {
  View tabView = target.getChildTabViewAt(tabIndex);
  setTargetView(tabView);
}
 
開發者ID:fancysherry,項目名稱:shr,代碼行數:5,代碼來源:BadgeView.java

示例7: onFinishInflate

import android.widget.TabWidget; //導入方法依賴的package包/類
/**
 * Setup the tab host and create all necessary tabs.
 */
@Override
protected void onFinishInflate() {
    // Setup the tab host
    setup();

    final ViewGroup tabsContainer = (ViewGroup) findViewById(R.id.tabs_container);
    final TabWidget tabs = (TabWidget) findViewById(com.android.internal.R.id.tabs);
    final AppsCustomizePagedView appsCustomizePane = (AppsCustomizePagedView)
            findViewById(R.id.apps_customize_pane_content);
    mTabs = tabs;
    mTabsContainer = tabsContainer;
    mAppsCustomizePane = appsCustomizePane;
    mAnimationBuffer = (ImageView) findViewById(R.id.animation_buffer);
    if (tabs == null || mAppsCustomizePane == null) throw new Resources.NotFoundException();

    // Configure the tabs content factory to return the same paged view (that we change the
    // content filter on)
    TabContentFactory contentFactory = new TabContentFactory() {
        public View createTabContent(String tag) {
            return appsCustomizePane;
        }
    };

    // Create the tabs
    TextView tabView;
    String label;
    label = mContext.getString(R.string.all_apps_button_label);
    tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
    tabView.setText(label);
    tabView.setContentDescription(label);
    addTab(newTabSpec(APPS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
    label = mContext.getString(R.string.widgets_tab_label);
    tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
    tabView.setText(label);
    tabView.setContentDescription(label);
    addTab(newTabSpec(WIDGETS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
    setOnTabChangedListener(this);

    // Setup the key listener to jump between the last tab view and the market icon
    AppsCustomizeTabKeyEventListener keyListener = new AppsCustomizeTabKeyEventListener();
    View lastTab = tabs.getChildTabViewAt(tabs.getTabCount() - 1);
    lastTab.setOnKeyListener(keyListener);
    View shopButton = findViewById(R.id.market_button);
    shopButton.setOnKeyListener(keyListener);

    // Hide the tab bar until we measure
    mTabsContainer.setAlpha(0f);
}
 
開發者ID:pengqinping,項目名稱:androidProject,代碼行數:52,代碼來源:AppsCustomizeTabHost.java

示例8: onFinishInflate

import android.widget.TabWidget; //導入方法依賴的package包/類
/**
 * Setup the tab host and create all necessary tabs.
 */
@Override
protected void onFinishInflate() {
    // Setup the tab host
    setup();

    final ViewGroup tabsContainer = (ViewGroup) findViewById(R.id.tabs_container);
    final TabWidget tabs = getTabWidget();
    final AppsCustomizePagedView appsCustomizePane = (AppsCustomizePagedView)
            findViewById(R.id.apps_customize_pane_content);
    mTabs = tabs;
    mTabsContainer = tabsContainer;
    mAppsCustomizePane = appsCustomizePane;
    mAnimationBuffer = (FrameLayout) findViewById(R.id.animation_buffer);
    mContent = (LinearLayout) findViewById(R.id.apps_customize_content);
    if (tabs == null || mAppsCustomizePane == null) throw new Resources.NotFoundException();

    // Configure the tabs content factory to return the same paged view (that we change the
    // content filter on)
    TabContentFactory contentFactory = new TabContentFactory() {
        public View createTabContent(String tag) {
            return appsCustomizePane;
        }
    };

    // Create the tabs
    TextView tabView;
    String label;
    label = getContext().getString(R.string.all_apps_button_label);
    tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
    tabView.setText(label);
    tabView.setContentDescription(label);
    addTab(newTabSpec(APPS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
    label = getContext().getString(R.string.widgets_tab_label);
    tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
    tabView.setText(label);
    tabView.setContentDescription(label);
    addTab(newTabSpec(WIDGETS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
    setOnTabChangedListener(this);

    // Setup the key listener to jump between the last tab view and the market icon
    AppsCustomizeTabKeyEventListener keyListener = new AppsCustomizeTabKeyEventListener();
    View lastTab = tabs.getChildTabViewAt(tabs.getTabCount() - 1);
    lastTab.setOnKeyListener(keyListener);
    View shopButton = findViewById(R.id.market_button);
    shopButton.setOnKeyListener(keyListener);

    // Hide the tab bar until we measure
    mTabsContainer.setAlpha(0f);
}
 
開發者ID:Lesik,項目名稱:open-gel-plus,代碼行數:53,代碼來源:AppsCustomizeTabHost.java

示例9: setUpTabInfos

import android.widget.TabWidget; //導入方法依賴的package包/類
private void setUpTabInfos() {
    TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
    if (tabHost != null) {
        tabHost.setup();

        final TabWidget tabWidget = tabHost.getTabWidget();
        final FrameLayout tabContent = tabHost.getTabContentView();

        // Get the original tab textviews and remove them from the viewgroup.
        TextView[] originalTextViews = new TextView[tabWidget.getTabCount()];
        for (int index = 0; index < tabWidget.getTabCount(); index++) {
            originalTextViews[index] = (TextView) tabWidget.getChildTabViewAt(index);
        }
        tabWidget.removeAllViews();

        // Ensure that all tab content childs are not visible at startup.
        for (int index = 0; index < tabContent.getChildCount(); index++) {
            tabContent.getChildAt(index).setVisibility(View.GONE);
        }

        // Create the tabspec based on the textview childs in the xml file.
        // Or create simple tabspec instances in any other way...
        for (int index = 0; index < originalTextViews.length; index++) {
            final TextView tabWidgetTextView = originalTextViews[index];
            final View tabContentView = tabContent.getChildAt(index);
            TabHost.TabSpec tabSpec = tabHost.newTabSpec((String) tabWidgetTextView.getTag());
            tabSpec.setContent(new TabHost.TabContentFactory() {
                @Override
                public View createTabContent(String tag) {
                    return tabContentView;
                }
            });
            if (tabWidgetTextView.getBackground() == null) {
                tabSpec.setIndicator(tabWidgetTextView.getText());
            } else {
                tabSpec.setIndicator(tabWidgetTextView.getText(), tabWidgetTextView.getBackground());
            }
            tabHost.addTab(tabSpec);
        }
    }
}
 
開發者ID:gandulf,項目名稱:DsaTab,代碼行數:42,代碼來源:TabEditActivity.java


注:本文中的android.widget.TabWidget.getChildTabViewAt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。