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