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


Java TabWidget.getTabCount方法代码示例

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


在下文中一共展示了TabWidget.getTabCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: onCreate

import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_view_fragment);

    // logo
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
        actionBar.setTitle("studieDOKK1");
        actionBar.setDisplayUseLogoEnabled(true);
        actionBar.setLogo(R.drawable.studiedokk1_logo_transparent_white);
    }

    mTabHost = (FragmentTabHost) findViewById(R.id.tabhost);
    mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        public void onTabChanged(String tabId) {
            View currentView = mTabHost.getCurrentView();

            if (mTabHost.getCurrentTab() > currentTab) {
                currentView.setAnimation(inFromRightAnimation());
            } else {
                currentView.setAnimation(outToRightAnimation());
            }

            currentTab = mTabHost.getCurrentTab();
        }
    });
    mTabHost.setup(this, getSupportFragmentManager(), R.id.tabcontent);
    mTabHost.addTab(
            mTabHost.newTabSpec("tab1").setIndicator("Aktiviteter", null),
            ActivitiesGridFragment.class, null);
    mTabHost.addTab(
            mTabHost.newTabSpec("tab2").setIndicator("Kort", null),
            MapFragment.class, null);

    TabWidget tw = mTabHost.getTabWidget();
    System.out.println("TW cnt: "+tw.getTabCount());
    for(int i = 0; i < tw.getTabCount(); i++){
        TextView tv = (TextView) tw.getChildAt(i).findViewById(android.R.id.title);
        tv.setTextColor(Color.WHITE);
    }

    mTabHost.setCurrentTab(1);

}
 
开发者ID:dkzeb,项目名称:studdyDokky,代码行数:47,代码来源:MainViewFragment.java

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