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


Java TabHost.setup方法代码示例

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


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

示例1: TabHandler

import android.widget.TabHost; //导入方法依赖的package包/类
public TabHandler(Activity activity)
{
	this.activity = activity;
	tabHost = (TabHost) activity.findViewById(R.id.id_tabHost);
	if (tabHost != null)
	{
		tabHost.setup();
		//canvas
		canvas = new Canvas(this.activity);
		firstTabs.put(canvas, getTabSpecForITab(canvas));
		//console
		console = new Console(this.activity);
		firstTabs.put(console, getTabSpecForITab(console));
		//init tabs
		canvas.init(new PipeListener()
		{
			@Override
			public void viewChanged()
			{
				checkAdditionalTabs();
			}
		});
		console.init();
	}
}
 
开发者ID:hcmlab,项目名称:ssj,代码行数:26,代码来源:TabHandler.java

示例2: onCreateView

import android.widget.TabHost; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    if (view == null) {
        view = inflater.inflate(R.layout.fragment_help, container, false);

        TabHost mTabHost = (TabHost) view.findViewById(android.R.id.tabhost);
        mTabHost.setup();

        ViewPager mViewPager = (ViewPager) view.findViewById(R.id.pager);
        TabsAdapter mTabsAdapter = new TabsAdapter(getActivity(), mTabHost, mViewPager);

        // Here we load the content for each tab.
        mTabsAdapter.addTab(mTabHost.newTabSpec("one").setIndicator("Setup"), PageOneFragment.class, null);
        mTabsAdapter.addTab(mTabHost.newTabSpec("two").setIndicator("Using"), PageTwoFragment.class, null);
        mTabsAdapter.addTab(mTabHost.newTabSpec("three").setIndicator("FAQ"), PageThreeFragment.class, null);
    }


    return view;
}
 
开发者ID:mtbii,项目名称:RobotCA,代码行数:23,代码来源:HelpFragment.java

示例3: onCreateView

import android.widget.TabHost; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.activity_my_files, container, false);

    myFileList = (ListView) v.findViewById(R.id.myFileList);
    myFileList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    myFileList.setOnItemClickListener(this);

    allEntities = FileSelectHelper.getFileEntities(FileSelectorActivity.getServerResponse());

    // Init tab host categories {My files}
    tabHostMyFile = (TabHost) v.findViewById(R.id.tabHostMyFiles);
    tabHostMyFile.setup();

    initTabHost(tabHostMyFile, getMyFilesCategories(allEntities));
    tabHostMyFile.setOnTabChangedListener(new MyFilesCategoriesListener());

    myFileList.setAdapter(getArrayAdapterForMyFiles(allEntities, tabHostMyFile.getCurrentTabTag()));

    FileEntity currentEntity = FileSelectorActivity.getCurrentEntity();
    tabHostMyFile.setCurrentTab(currentTab);
    FileSelectorActivity.setCurrentEntity(currentEntity);

    return v;
}
 
开发者ID:SequencingDOTcom,项目名称:RTP-API-Gradle-Maven-Android-File-Selector-Java,代码行数:27,代码来源:MyFileActivity.java

示例4: onCreate

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

  TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
  tabHost.setup();
  
  tabHost.addTab(tabHost.newTabSpec("t1").setIndicator(getString(R.string.folder_new)).setContent(this));
  tabHost.addTab(tabHost.newTabSpec("t2").setIndicator(getString(R.string.folder_existing)).setContent(this));
  tabHost.setCurrentTab(0);
  tabHost.setOnTabChangedListener(this);

  onTabChanged(null);

  mIconPicker = new IconPicker(this, true);
  mIconSelect = (ImageView) findViewById(R.id.folder_icon);
  mIconSelect.setOnClickListener(this);
}
 
开发者ID:sunnygoyal,项目名称:PowerToggles,代码行数:21,代码来源:FolderPick.java

示例5: onCreate

import android.widget.TabHost; //导入方法依赖的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

示例6: onCreateView

import android.widget.TabHost; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	_viewRoot = inflater.inflate(R.layout.fragment_tabs, null);
       
	_tabHost = (TabHost)_viewRoot.findViewById(android.R.id.tabhost);
       _tabHost.setup();
       
       for (TabDefinition tab : TAB_DEFINITIONS) {
       	_tabHost.addTab(createTab(inflater, _tabHost, _viewRoot, tab));	
       }
       
       return _viewRoot;
}
 
开发者ID:alaskalinuxuser,项目名称:apps_small,代码行数:14,代码来源:TabsFragment.java

示例7: onCreateView

import android.widget.TabHost; //导入方法依赖的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

示例8: createView

import android.widget.TabHost; //导入方法依赖的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

示例9: setupTabs

import android.widget.TabHost; //导入方法依赖的package包/类
protected void setupTabs()
{
	TabHost tabHost = (TabHost) findViewById(R.id.tabhost);
	tabHost.setup();

	//  get the tab tags.
	mTagHidden = getResources().getString(R.string.hidden_tab);
	mTagFile = getResources().getString(R.string.file_tab);
	mTagAnnotate = getResources().getString(R.string.annotate_tab);
	mTagPages = getResources().getString(R.string.pages_tab);

	//  first tab is and stays hidden.
	//  when the search tab is selected, we programmatically "select" this hidden tab
	//  which results in NO tabs appearing selected in this tab host.
	setupTab(tabHost, mTagHidden, R.id.hiddenTab, R.layout.tab);
	tabHost.getTabWidget().getChildTabViewAt(0).setVisibility(View.GONE);

	//  these tabs are shown.
	setupTab(tabHost, mTagFile, R.id.fileTab, R.layout.tab_left);
	setupTab(tabHost, mTagAnnotate, R.id.annotateTab, R.layout.tab);
	setupTab(tabHost, mTagPages, R.id.pagesTab, R.layout.tab_right);

	//  start by showing the edit tab
	tabHost.setCurrentTabByTag(mTagFile);

	tabHost.setOnTabChangedListener(this);
}
 
开发者ID:ArtifexSoftware,项目名称:mupdf-android-viewer-nui,代码行数:28,代码来源:DocActivityView.java

示例10: onCreateView

import android.widget.TabHost; //导入方法依赖的package包/类
@Override
	public View onCreateView(final LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = super.onCreateView(inflater, container, savedInstanceState);
		
		final TabHost tabHost = (TabHost) view.findViewById(android.R.id.tabhost);
    	
		tabHost.setup();
//        TabHost.TabSpec spec = tabHost.newTabSpec("Chat");
//        spec.setIndicator("Chat");
//        spec.setContent(new TabHost.TabContentFactory() {
//			@Override
//			public View createTabContent(String tag) {
//				return inflater.inflate(R.layout.game_chat, null);
//			}
//		});
//        tabHost.addTab(spec);

		TabHost.TabSpec spec = tabHost.newTabSpec("Games");
        spec.setIndicator("Games");
        spec.setContent(new TabHost.TabContentFactory() {

            @Override
            public View createTabContent(String tag) {
                return (new Button(getActivity()));
            }
        });
        tabHost.addTab(spec);
        
        return view;
	}
 
开发者ID:eduyayo,项目名称:gamesboard,代码行数:32,代码来源:ContactDetailFragment.java

示例11: onCreate

import android.widget.TabHost; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tab_browse);
    // local server startup
    upnpClient = UpnpClient.getInstance(getApplicationContext());


    tabHost = (TabHost) findViewById(R.id.browserTabHost);
    tabHost.setup(this.getLocalActivityManager());
    serverTab = tabHost.newTabSpec("server").setIndicator(getResources().getString(R.string.title_activity_server_list), getResources().getDrawable(R.drawable.device_48_48)).setContent(new Intent(this, ServerListActivity.class));
    tabHost.addTab(serverTab);
    contentTab = tabHost.newTabSpec("content").setIndicator(getResources().getString(R.string.title_activity_content_list), getResources().getDrawable(R.drawable.cdtrack)).setContent(new Intent(this, ContentListActivity.class));
    tabHost.addTab(contentTab);
    receiverTab = tabHost.newTabSpec("receiver").setIndicator(getResources().getString(R.string.title_activity_receiver_list), getResources().getDrawable(R.drawable.laptop_48_48)).setContent(new Intent(this, ReceiverListActivity.class));
    tabHost.addTab(receiverTab);
    playerTab = tabHost.newTabSpec("player").setIndicator(getResources().getString(R.string.title_activity_player_list), getResources().getDrawable(R.drawable.player_play)).setContent(new Intent(this, PlayerListActivity.class));
    tabHost.addTab(playerTab);


    // add ourself as listener
    upnpClient.addUpnpClientListener(this);
    if(savedInstanceState != null){
        setCurrentTab(Tabs.valueOf(savedInstanceState.getInt(CURRENT_TAB_KEY, Tabs.CONTENT.ordinal())));
    }else if (upnpClient.getProviderDevice() != null) {
        setCurrentTab(Tabs.CONTENT);

    }
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:30,代码来源:TabBrowserActivity.java

示例12: onCreate

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

	mContext = this;

	tabhost = (TabHost) findViewById(R.id.tabhost);
	tabhost.setup();

	LayoutInflater i = LayoutInflater.from(this);
	i.inflate(R.layout.tab_login, tabhost.getTabContentView());
	i.inflate(R.layout.tab_register, tabhost.getTabContentView());// ��̬����XML��������ҪActivity

	tabhost.addTab(tabhost.newTabSpec("tab1").setIndicator("��¼").setContent(R.id.tab_login));
	tabhost.addTab(tabhost.newTabSpec("tab2").setIndicator("ע��").setContent(R.id.tab_register));
	// ������ʵ��ǩ
	tabhost.setCurrentTab(0);

	findViewById(R.id.bt_cancle).setOnClickListener(this);
	findViewById(R.id.bt_confirm).setOnClickListener(this);
	findViewById(R.id.bt_rcancle).setOnClickListener(this);
	findViewById(R.id.bt_rconfirm).setOnClickListener(this);
	findViewById(R.id.btn_show_id).setOnClickListener(this);

	et_id = (EditText) findViewById(R.id.et_id);
	et_password = (EditText) findViewById(R.id.et_password);
	et_rid = (EditText) findViewById(R.id.et_rid);
	et_rpassword = (EditText) findViewById(R.id.et_rpassword);
	et_rpassword2 = (EditText) findViewById(R.id.et_rpassword2);
	et_remail = (EditText) findViewById(R.id.et_remail);
	et_rphonenum = (EditText) findViewById(R.id.et_rphonenum);
	et_rnum = (EditText) findViewById(R.id.et_rnum);

	lv_showid = (ListView) findViewById(R.id.lv_showid);

	MylistAdapter mylistAdapter = new MylistAdapter();
	lv_showid.setAdapter(mylistAdapter);
	lv_showid.setOnItemClickListener(this);
}
 
开发者ID:REIGE,项目名称:AndroidTest,代码行数:41,代码来源:LoginActivity.java

示例13: onCreateView

import android.widget.TabHost; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_tab_host, container, false);

    TabHost tabhost = (TabHost) rootView.findViewById(android.R.id.tabhost);
    tabhost.setup();

    TabHost.TabSpec tab1 = tabhost.newTabSpec("tab1");
    tab1.setIndicator("タブ1");
    tab1.setContent(R.id.tab1);
    tabhost.addTab(tab1);

    TabHost.TabSpec tab2 = tabhost.newTabSpec("tab2");
    tab2.setIndicator("タブ2");
    tab2.setContent(R.id.tab2);
    tabhost.addTab(tab2);

    TabHost.TabSpec tab3 = tabhost.newTabSpec("tab3");
    tab3.setIndicator("タブ3");
    tab3.setContent(R.id.tab3);
    tabhost.addTab(tab3);

    tabhost.setCurrentTab(0);

    return rootView;
}
 
开发者ID:yokmama,项目名称:honki_android2,代码行数:28,代码来源:TabHostFragment.java

示例14: onCreate

import android.widget.TabHost; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.cfg_strectch_editor);
  mImg = (Bitmap) getIntent().getParcelableExtra("img");

  mStretchRect = getExtra(KEY_STRETCH);
  mPaddingRect = getExtra(KEY_PADDING);

  mTabHost = (TabHost) findViewById(android.R.id.tabhost);
  mTabHost.setup();
  mPager = (SwipePager) findViewById(R.id.swipeTabs);

  mTabHost.addTab(mTabHost.newTabSpec("t1").setIndicator(getString(R.string.npe_stretch)).setContent(this));
  mTabHost.addTab(mTabHost.newTabSpec("t2").setIndicator(getString(R.string.npe_padding)).setContent(this));
  mTabHost.setOnTabChangedListener(this);
  mPager.setOnPageChangeListener(this);
  mPager.setDisplayChild(0);

  
  mNinePatchView = (NinePatchView) findViewById(R.id.prewiewHolder);
  mNinePatchView.setBitmap(mImg);
  mNinePatchView.setDim(mStretchRect);
  LayoutParams lp = mNinePatchView.getLayoutParams();
  lp.height = Math.max(lp.height, mImg.getHeight() * 3 / 2);

  mStretchView = setRect(R.id.stretch_rect, mStretchRect, 2);
  setRect(R.id.padding_rect, mPaddingRect, 3);
}
 
开发者ID:sunnygoyal,项目名称:PowerToggles,代码行数:30,代码来源:NinePatchEditor.java

示例15: onCreate

import android.widget.TabHost; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        backGround = (LinearLayout) findViewById(R.id.background);
        getSupportActionBar().hide();

        tabHost = (TabHost)findViewById(R.id.tab_host);
        tabHost.setup();
        tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
            @Override
            public void onTabChanged(String tabId) {
                FragmentTransaction fragmentTransaction = getFragmentManager()
                        .beginTransaction();
                if(TextUtils.equals("first",tabId)){
                    //
                    contents = new homeFragement();
                }else if(TextUtils.equals("second",tabId)){
                    //
                    contents = new downloadFragment();
                }
                fragmentTransaction.replace(android.R.id.tabcontent, contents,"frag");
                fragmentTransaction.commit();
            }
        });
        tabHost.addTab(tabHost.newTabSpec("first").setIndicator("主页").setContent(new TabFactory(this)));
        tabHost.addTab(tabHost.newTabSpec("second").setIndicator("下载").setContent(new TabFactory(this)));

//        背景图片透明度
        backGround.getBackground().setAlpha(100);

    }
 
开发者ID:webhood,项目名称:ThisBili,代码行数:33,代码来源:MainActivity.java


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