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


Java TabWidget.getChildCount方法代碼示例

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


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

示例1: changeTabBackGround

import android.widget.TabWidget; //導入方法依賴的package包/類
private void changeTabBackGround() { // 改變選項卡的顏色
	// 得到當前選中選項卡的索引
	int index = getTabHost().getCurrentTab();
	// 調用tabhost中的getTabWidget()方法得到TabWidget
	TabWidget tabWidget = getTabHost().getTabWidget();
	// 得到選項卡的數量
	int count = tabWidget.getChildCount();
	// 循環判斷,隻有點中的索引值改變背景顏色,其他的則恢複未選中的顏色
	for (int i = 0; i < count; i++) {
		View view = tabWidget.getChildAt(i);
		TextView tv = (TextView) tabWidget.getChildAt(i).findViewById(
				android.R.id.title);
		tv.setTextSize(20);
		if (index == i) {
			view.setBackgroundResource(color.holo_blue_dark);
		} else {
			view.setBackgroundResource(color.holo_blue_light);
		}
	}
}
 
開發者ID:z9961,項目名稱:DoList,代碼行數:21,代碼來源:MainActivity.java

示例2: setTabWidget

import android.widget.TabWidget; //導入方法依賴的package包/類
public void setTabWidget(Context context, TabWidget tabwidget)
{
	SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
	int themeSet = Integer.parseInt(sharedPreferences.getString("preferences_theme_set", "0"));
	int colorThemeSet = Integer.parseInt(sharedPreferences.getString("preferences_color_theme_set", "7"));
	
	for(int i = 0; i < tabwidget.getChildCount(); i++)
	{
		View v = tabwidget.getChildAt(i);

		TextView textview = (TextView)v.findViewById(android.R.id.title);
		if(textview == null)
		{
				continue;
		}

		v.setBackgroundResource(tabwidget_drawable[themeSet][colorThemeSet]);
	}
   }
 
開發者ID:vassela,項目名稱:AC2RD,代碼行數:20,代碼來源:ThemeManager.java

示例3: setTabHostSelector

import android.widget.TabWidget; //導入方法依賴的package包/類
public static void setTabHostSelector(TabHost host, int selector) {
    if (host == null) {
        return;
    }
    TabWidget widget = host.getTabWidget();
    if (widget == null) {
        return;
    }
    for(int i = 0; i < widget.getChildCount(); i++) {
        View v = widget.getChildAt(i);
        if (v == null) {
            continue;
        }
        TextView tv = (TextView) v.findViewById(android.R.id.title);
        if (tv == null) {
            continue;
        }
        v.setBackgroundResource(selector);
    }
}
 
開發者ID:DanDits,項目名稱:WhatsThat,代碼行數:21,代碼來源:UiStyleUtil.java

示例4: setUpTabs

import android.widget.TabWidget; //導入方法依賴的package包/類
private void setUpTabs() {
    List<TabModel> tabs = tabsToAdd();

    fragmentManager = getSupportFragmentManager();
    tabHost.setup(this, fragmentManager, android.R.id.tabcontent);
    for (int i = 0; i < tabs.size(); i ++){
        TabModel tab = tabs.get(i);
        tabHost.addTab(
                tabHost.newTabSpec(tab.getTag()).setIndicator(tab.getName(), null),
                tab.getFragmentClass(),
                tab.getFragmentArgs());
    }

    TabWidget widget = tabHost.getTabWidget();

    for (int i = 0; i < widget.getChildCount(); i++) {
        final TextView tv = (TextView) widget.getChildAt(i).findViewById(
                android.R.id.title);
        tv.setTextColor(this.getResources().getColorStateList(
                R.color.tab_selector));
        tv.setSingleLine(true);
        tv.setAllCaps(true);
    }
}
 
開發者ID:edx,項目名稱:edx-app-android,代碼行數:25,代碼來源:BaseTabActivity.java

示例5: createTabs

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

	tabHost.setup();

	addTab(tabHost, "contact_query", R.string.label_keyword,
			R.id.tabContactQuery);
	addTab(tabHost, "ip_query", R.string.label_ip, R.id.tabIPQuery);

	TabWidget tabWidget = tabHost.getTabWidget();
	if (tabWidget == null)
		return tabHost;

	for (int i = 0; i < tabWidget.getChildCount(); i++) {
		tabWidget.getChildAt(i).getLayoutParams().height = 60;
	}

	return tabHost;
}
 
開發者ID:lyshie,項目名稱:nthu-cis,代碼行數:22,代碼來源:FindNTHUActivity.java

示例6: setAppear

import android.widget.TabWidget; //導入方法依賴的package包/類
public void setAppear(int flag){
	tabWidget = (TabWidget) findViewById(android.R.id.tabs);  

	tabWidget.setBackgroundResource(R.drawable.black_bg);  
      
      for (int i = 0; i < tabWidget.getChildCount(); i++) {  
          final TextView tv = (TextView) tabWidget.getChildAt(i)  
                  .findViewById(android.R.id.title);  
          tabWidget.getChildAt(i).getLayoutParams().height = 60;  
          if (i == flag) {  
              tabWidget.getChildAt(i).setBackgroundResource(  
                      R.drawable.tab_bankground);//設置背景  
              tv.setTextColor(Color.rgb(202, 151, 0));  
          } else {  
              tabWidget.getChildAt(i)  
                      .setBackgroundResource(R.drawable.tab_bankground2);  
              tv.setTextColor(Color.WHITE);  
              tabWidget.getChildAt(i).setClickable(true);  
          }  
          tv.setTextSize(15);  
      }
    
}
 
開發者ID:Tifosi-M,項目名稱:Hi-Top,代碼行數:24,代碼來源:Communitymain.java

示例7: setupTabs

import android.widget.TabWidget; //導入方法依賴的package包/類
private void setupTabs(TabHost host) {
    host.setup();
    TabHost.TabSpec spec;

    // Set up titles
    int[] tabContents = new int[]{R.id.addEditItemTab0, R.id.addEditItemTab1, R.id.addEditItemTab2, R.id.addEditItemTab3, R.id.addEditItemTab4, R.id.addEditItemTab5};

    for (int i = -1; ++i < Constants.TAB_TITLES.length; ) {
        //Tabs
        spec = host.newTabSpec(Constants.TAB_TITLES[i]);
        spec.setContent(tabContents[i]);
        spec.setIndicator(Constants.TAB_TITLES[i]);
        host.addTab(spec);
        ((TextView) host.getTabWidget().getChildAt(i).findViewById(android.R.id.title)).setAllCaps(false);
    }

    // Apply the right style
    TabWidget widget = host.getTabWidget();
    for(int i = 0; i < widget.getChildCount(); i++) {
        View v = widget.getChildAt(i);

        // Look for the title view to ensure this is an indicator and not a divider.
        TextView tv = (TextView)v.findViewById(android.R.id.title);
        if(tv == null) {
            continue;
        }
        v.setBackgroundResource(R.drawable.tab_indicator_ab_green);
    }
}
 
開發者ID:davidcampelo,項目名稱:PublicOpenSpaceToolApp,代碼行數:30,代碼來源:PublicOpenSpaceAddEditFragment.java

示例8: setTabBackground

import android.widget.TabWidget; //導入方法依賴的package包/類
@Override
public void setTabBackground(TabWidget tabWidget) {
  for (int i = 0; i < tabWidget.getChildCount(); i++) {
    tabWidget.getChildAt(i).setBackgroundResource(R.drawable.tab_indicator_mytracks);
  }
}
 
開發者ID:Plonk42,項目名稱:mytracks,代碼行數:7,代碼來源:Api11Adapter.java

示例9: onCreate

import android.widget.TabWidget; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.demo_tab_view);

    mTabWidget = ( TabWidget) findViewById(R.id.tabWidget1);

    mTabWidget.setStripEnabled(false);
    mTabWidget.setFocusable(false);

    for (int i = 0; i < mTabWidget.getChildCount(); i++) {
        mTabWidget.getChildAt(i).setOnClickListener(mTabClickListener);
        mTabWidget.getChildAt(i).setOnFocusChangeListener(mTabFocusListener);
    }

    mViewPager = (ViewPager) findViewById(R.id.viewPager1);
    mPagerAdapter = new MyPagerAdapter();
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setOnPageChangeListener(mPageChangeListener);

    mPagerAdapter.notifyDataSetChanged();


    mTabWidget.focusCurrentTab(0);

    BorderView borderView = new BorderView(this);

    borderView.setBackgroundResource(R.drawable.border_highlight);
    borderView.attachTo(mTabWidget);

    BorderView borderView2 = new BorderView(this);

     borderView2.setBackgroundResource(R.drawable.border_white_light_10);
    borderView2.attachTo(mViewPager);

}
 
開發者ID:evilbinary,項目名稱:TvWidget,代碼行數:38,代碼來源:DemoTabActivity.java


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