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


Java TabSpec.setContent方法代码示例

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


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

示例1: onCreate

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_base_clear_cache);
		
		//1.����ѡ�1
		TabSpec tab1 = getTabHost().newTabSpec("clear_cache").setIndicator("��������");
//		ImageView imageView = new ImageView(this); 
//		imageView.setBackgroundResource(R.drawable.ic_launcher);
//		View view = View.inflate(this, R.layout.test, null);
		
//		TabSpec tab1 = getTabHost().newTabSpec("clear_cache").setIndicator(view);
		
		//2.����ѡ�2
		TabSpec tab2 = getTabHost().newTabSpec("sd_cache_clear").setIndicator("sd������");
		
		//3.��֪����ѡ���������
		tab1.setContent(new Intent(this,CacheClearActivity.class));
		tab2.setContent(new Intent(this,SDCacheClearActivity.class));
		
		//4.��������ѡ�ά��host(ѡ�����)��ȥ
		getTabHost().addTab(tab1);
		getTabHost().addTab(tab2);
	}
 
开发者ID:cckevincyh,项目名称:mobilesafe,代码行数:25,代码来源:BaseCacheClearActivity.java

示例2: onCreate

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mTabHost = (TabHost) findViewById(R.id.edit_item_tab_host);
    mTabHost.setup(getLocalActivityManager());

    TabSpec tabCall = mTabHost.newTabSpec("TAB_Call");
    tabCall.setIndicator("电话");
    tabCall.setContent(new Intent(this, AnswerCallActivity.class));
    mTabHost.addTab(tabCall);

    TabSpec tabMessage = mTabHost.newTabSpec("TAB_Message");
    tabMessage.setIndicator("短信");
    tabMessage.setContent(new Intent(this, AnswerMessageActivity.class));
    mTabHost.addTab(tabMessage);

    mTabHost.setCurrentTab(0);
}
 
开发者ID:jp1017,项目名称:AutoAnswerCalls,代码行数:20,代码来源:MainActivity.java

示例3: initTabs

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
private void initTabs() {
    MainTab[] tabs = MainTab.values();
    final int size = tabs.length;
    for (int i = 0; i < size; i++) {
        MainTab mainTab = tabs[i];
        TabSpec tab = mTabHost.newTabSpec(getString(mainTab.getResName()));

        View indicator = inflateView(R.layout.v2_tab_indicator);
        ImageView icon = (ImageView) indicator.findViewById(R.id.tab_icon);
        icon.setImageResource(mainTab.getResIcon());
        TextView title = (TextView) indicator.findViewById(R.id.tab_titile);
        title.setText(getString(mainTab.getResName()));
        tab.setIndicator(indicator);
        tab.setContent(new TabContentFactory() {

            @Override
            public View createTabContent(String tag) {
                return new View(MainActivity.this);
            }
        });

        mTabHost.addTab(tab, mainTab.getClz(), null);

    }
}
 
开发者ID:leerduo,项目名称:OschinaMainFrameWorkWithToolBar,代码行数:26,代码来源:MainActivity.java

示例4: createOnePOSTab

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
/** Creates tab with part of entry related to one language and one part of speech, 
 * runs POS activity. 
 **/ 
public void createOnePOSTab(TPage _tpage, TLang _tlang, TLangPOS _lang_pos) {
   
    Bundle b = new Bundle();
    b.putInt("page_id", _tpage.getID()); // pass parameter: TPage by page_id
    b.putInt("lang_id", _tlang.getID()); // pass parameter: TLang by lang_id
    b.putInt("lang_pos_id", _lang_pos.getID()); // pass parameter: TLangPOS by lang_pos_id
    
    Intent i = new Intent(this, WCPOSActivity.class);
    
    i.putExtras(b);
    //System.out.println("Source activity: page_id = " + _tpage.getID() 
    //                    + "; lang_id = " + _tlang.getID()
    //                    + "; lang_pos_id = " + _lang_pos.getID());
    
    TabSpec _tabspec = tab_host_pos.newTabSpec( "" + _lang_pos.getID() ); // some unique text
    _tabspec.setIndicator( getShortPOSText(_lang_pos) );
    _tabspec.setContent(i);
    tab_host_pos.addTab(_tabspec);
}
 
开发者ID:componavt,项目名称:wikokit,代码行数:23,代码来源:WCLanguageActivity.java

示例5: createOneLanguageTab

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
/** Creates tab with part of entry related to one language, 
 * runs language activity. 
 **/ 
public void createOneLanguageTab(TPage _tpage, TLang _tlang) {  //TLangPOS _lang_pos) {
   
    Bundle b = new Bundle();
    b.putInt("page_id", _tpage.getID()); // pass parameter: TPage by page_id
    b.putInt("lang_id", _tlang.getID()); // pass parameter: TLang by lang_id
    
    Intent i = new Intent(this, WCLanguageActivity.class);
    //Intent i = new Intent().setClass(this, WCLanguageActivity.class);  
    
    i.putExtras(b);
    //System.out.println("Source activity: page_id = " + _tpage.getID() + "; lang_id = " + _tlang.getID());
    
    TabSpec _tabspec = tab_host_languages.newTabSpec( "" + _tlang.getID() ); // some unique text

    LanguageType _lang = _tlang.getLanguage();
    _tabspec.setIndicator(_lang.getCode());
    _tabspec.setContent(i);
    
    tab_host_languages.addTab(_tabspec);
}
 
开发者ID:componavt,项目名称:wikokit,代码行数:24,代码来源:WCActivity.java

示例6: initTabs

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
/**
 * initializes the pages in the tabbed dialog
 */
protected void initTabs() {
	// Setup the tabbed dialog on the layout and add the content of each tab
	TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
	tabHost.setup();
	TabSpec localTabSpec = tabHost.newTabSpec(localTabString());
	localTabSpec.setContent(R.id.localGameTab);
	localTabSpec.setIndicator(localTabString());
	TabSpec remoteTabSpec = tabHost.newTabSpec(remoteTabString());
	remoteTabSpec.setContent(R.id.remoteGameTab);
	remoteTabSpec.setIndicator(remoteTabString());
	tabHost.addTab(localTabSpec);
	tabHost.addTab(remoteTabSpec);
	
	// make sure the current tab is the right one
	tabHost.setCurrentTab(config.isLocal() ? 0 : 1);

}
 
开发者ID:MaxRobinson,项目名称:Phase10,代码行数:21,代码来源:GameMainActivity.java

示例7: onCreate

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) 
{

	super.onCreate(savedInstanceState);

	setContentView(R.layout.activity_main_tabhost);

	TabHost tabHost = getTabHost();
	
	TabSpec tabSpec1 = tabHost.newTabSpec("Home");
	TabSpec tabSpec2 = tabHost.newTabSpec("Second");

	tabSpec1.setIndicator("Home");
	tabSpec2.setIndicator("Second");
	Intent photosIntent = new Intent(this, GridViewActivity.class);
	Intent secondactivIntent = new Intent(this, SecondActivity.class);
	tabSpec1.setContent(photosIntent);
	tabSpec2.setContent(secondactivIntent);

	tabHost.addTab(tabSpec1);
	tabHost.addTab(tabSpec2);


}
 
开发者ID:joaogithub,项目名称:Testes,代码行数:27,代码来源:TabsActivity.java

示例8: initTabs

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
private void initTabs()
{
    mTabHost = (TabHost)mView.findViewById(android.R.id.tabhost);
    mTabHost.setup();
    
    final TabSpec spec1 = mTabHost.newTabSpec(TAB_TAG_INFO);
    spec1.setContent(R.id.color_info_view_tab_info);
    spec1.setIndicator(getString(R.string.color_info_tab_info));
    
    final TabSpec spec2 = mTabHost.newTabSpec(TAB_TAG_SIMILAR);
    spec2.setContent(R.id.color_info_view_tab_similar);
    spec2.setIndicator(getString(R.string.color_info_tab_similar));
    
    mTabHost.addTab(spec1);
    mTabHost.addTab(spec2);
}
 
开发者ID:TianziHou,项目名称:tzPalette,代码行数:17,代码来源:ColorInfoDialogFragment.java

示例9: onCreate

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tab);
    TabHost host = (TabHost)findViewById(android.R.id.tabhost);
    TabSpec spec = host.newTabSpec("tab1");
    spec.setContent(R.id.tab1);
    spec.setIndicator("Button1");
    
    host.addTab(spec);
    spec = host.newTabSpec("tab2");
    spec.setContent(R.id.tab2);
    spec.setIndicator("Next Button");
    host.addTab(spec);
    spec = host.newTabSpec("tab3");
    spec.setContent(R.id.tab3);
    spec.setIndicator("Just some text");
    host.addTab(spec);
    
}
 
开发者ID:vogellacompany,项目名称:codeexamples-android,代码行数:22,代码来源:TabTest.java

示例10: createTabSpec

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
@SuppressLint("InflateParams")
private TabSpec createTabSpec(TabHost tabHost, String tag,
       Resources res, int labelId, int iconId, Class<?> cls) {
	TabSpec spec = tabHost.newTabSpec(tag);
	String label = res.getString(labelId);
	Drawable icon = res.getDrawable(iconId);

	LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.tab, null);
	((ImageView) linearLayout.findViewById(R.id.tab_icon)).setImageDrawable(icon);
	((TextView) linearLayout.findViewById(R.id.tab_label)).setText(label);
	spec.setIndicator(linearLayout);
	spec.setContent(new Intent().setClass(this, cls));
			
	return spec;

}
 
开发者ID:mingzhou,项目名称:LogisticsPlatform,代码行数:17,代码来源:MainActivity.java

示例11: createTab

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
/**
 * Creates a {@link TabSpec} based on the specified parameters.
 * @param inflater The {@link LayoutInflater} responsible for creating {@link View}s.
 * @param tabHost The {@link TabHost} used to create new {@link TabSpec}s.
 * @param root The root {@link View} for the {@link Fragment}.
 * @param tabDefinition The {@link TabDefinition} that defines what the tab will look and act like.
 * @return A new {@link TabSpec} instance.
 */
private TabSpec createTab(LayoutInflater inflater, TabHost tabHost, View root, TabDefinition tabDefinition) {
	ViewGroup tabsView = (ViewGroup)root.findViewById(android.R.id.tabs);
	View tabView = tabDefinition.createTabView(inflater, tabsView);
	 
       TabSpec tabSpec = tabHost.newTabSpec(tabDefinition.getId());
       tabSpec.setIndicator(tabView);
       tabSpec.setContent(tabDefinition.getTabContentViewId());
       return tabSpec;
   }
 
开发者ID:alaskalinuxuser,项目名称:apps_small,代码行数:18,代码来源:TabsFragment.java

示例12: onCreateView

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState)
{
    super.onCreateView(inflater, container, savedInstanceState);
    
    View v = inflater.inflate(R.layout.result_tabhost_pager, container, false);
	tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
	tabHost.setup();
	tabHost.setOnTabChangedListener(this);
	
	for (int i = 0; i < pagerAdapter.getCount(); i++) {
		TabSpec tab = tabHost.newTabSpec(String.valueOf(i));
		//tab.setIndicator(getActivity().getResources().getStringArray(R.array.result_page_title)[i]);
		tab.setContent(android.R.id.tabcontent);
		    		    		
		View indicator = inflater.inflate(R.layout.tabhost_indicator, null);
		TextView title = (TextView) indicator.findViewById(android.R.id.title);
		title.setText(pagerAdapter.getPageTitle(i));
		tab.setIndicator(indicator);
		tabHost.addTab(tab);
	}

    viewPager = (ExtendedViewPager) v.findViewById(R.id.pager);
    viewPager.setAdapter(pagerAdapter);
    
    viewPager.setOnPageChangeListener(this);
    setCurrentPosition(0);

	scroller = (HorizontalScrollView) v.findViewById(R.id.tabwidget_scrollview);
   	viewPager.setCurrentItem(initPageIndex);
	
    return v;
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:34,代码来源:QoSTestDetailPagerFragment.java

示例13: createView

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
private View createView(View v, LayoutInflater inflater, int currentPage) {
	tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
	tabHost.setup();
	tabHost.setOnTabChangedListener(this);
	
	for (int i = 0; i < pagerAdapter.getCount(); i++) {
		TabSpec tab = tabHost.newTabSpec(String.valueOf(i));
		//tab.setIndicator(getActivity().getResources().getStringArray(R.array.result_page_title)[i]);
		tab.setContent(android.R.id.tabcontent);
		    		
		
		View indicator = inflater.inflate(R.layout.tabhost_indicator, null);
		TextView title = (TextView) indicator.findViewById(android.R.id.title);
		title.setText(getActivity().getResources().getStringArray(R.array.result_page_title)[RMBTResultPagerAdapter.RESULT_PAGE_TAB_TITLE_MAP.get(i)]);
		
		if (MAP_INDICATOR_DYNAMIC_VISIBILITY) {
			if (i == RMBTResultPagerAdapter.RESULT_PAGE_MAP) {
				indicator.setVisibility(View.GONE);
			}
		}
		tab.setIndicator(indicator);
		
		tabHost.addTab(tab);
	}
	
	scroller = (HorizontalScrollView) v.findViewById(R.id.tabwidget_scrollview);
	
    viewPager = (ExtendedViewPager) v.findViewById(R.id.pager);
    viewPager.setAdapter(pagerAdapter);
    
    viewPager.setOnPageChangeListener(this);
    setCurrentPosition(currentPage);

    return v;
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:36,代码来源:RMBTResultPagerFragment.java

示例14: addTab

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
public void addTab(TabSpec tabSpec, Class<?> clss, Bundle args) {
    tabSpec.setContent(new DummyTabFactory(this.mContext));
    String tag = tabSpec.getTag();
    TabInfo info = new TabInfo(tag, clss, args);
    if (this.mAttached) {
        info.fragment = this.mFragmentManager.findFragmentByTag(tag);
        if (!(info.fragment == null || info.fragment.isDetached())) {
            FragmentTransaction ft = this.mFragmentManager.beginTransaction();
            ft.detach(info.fragment);
            ft.commit();
        }
    }
    this.mTabs.add(info);
    addTab(tabSpec);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:16,代码来源:FragmentTabHost.java

示例15: newTab

import android.widget.TabHost.TabSpec; //导入方法依赖的package包/类
private TabSpec newTab(String tag, int labelId, int tabContentId) {
	Log.d(TAG, "buildTab(): tag=" + tag);

	View indicator = LayoutInflater.from(getActivity()).inflate(
			R.layout.tab,
			(ViewGroup) mRoot.findViewById(android.R.id.tabs), false);
	((TextView) indicator.findViewById(R.id.text)).setText(labelId);

	TabSpec tabSpec = mTabHost.newTabSpec(tag);
	tabSpec.setIndicator(indicator);
	Log.d(tag, tabContentId + " tabContentId " + indicator.getId()
			+ " indicator get Id ");
	tabSpec.setContent(tabContentId);
	return tabSpec;
}
 
开发者ID:kaetter,项目名称:motolog,代码行数:16,代码来源:TabsFragment.java


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