当前位置: 首页>>代码示例>>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;未经允许,请勿转载。