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


Java TabHost類代碼示例

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


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

示例1: onShowSearch

import android.widget.TabHost; //導入依賴的package包/類
public void onShowSearch()
{
	//  "deselect" all the visible tabs by selecting the hidden (first) one
	TabHost tabHost = (TabHost)findViewById(R.id.tabhost);
	tabHost.setCurrentTabByTag("HIDDEN");

	//  show search as selected
	showSearchSelected(true);

	//  hide all the other tabs
	hideAllTabs();

	//  show the search tab
	findViewById(R.id.searchTab).setVisibility(View.VISIBLE);
	mSearchText.getText().clear();
}
 
開發者ID:ArtifexSoftware,項目名稱:mupdf-android-viewer-nui,代碼行數:17,代碼來源:DocActivityView.java

示例2: createRotateTab

import android.widget.TabHost; //導入依賴的package包/類
private void createRotateTab(final LayoutInflater inflater, final ViewGroup container, final SeekBar.OnSeekBarChangeListener listener) {
    TabHost.TabSpec spec;

    spec = mTabHost.newTabSpec(getString(R.string.rotate_tab));
    spec.setIndicator(createTabView(inflater, container, getString(R.string.rotate_title)));

    spec.setContent(new TabHost.TabContentFactory() {

        @Override
        public View createTabContent(String tag) {

            View view = inflater.inflate(R.layout.fragment_rotate, container, false);

            mRotateSeekBar = (RangeSeekBar) view.findViewById(R.id.rotate_seekBar);
            mRotateSeekBar.setRange(getResources().getIntArray(R.array.angle_seekbar_values));
            mRotateSeekBar.setOnSeekBarChangeListener(listener);

            return (view);

        }
    });
    mTabHost.addTab(spec);
}
 
開發者ID:hollaus,項目名稱:TinyPlanetMaker,代碼行數:24,代碼來源:TabFragment.java

示例3: createWarpTab

import android.widget.TabHost; //導入依賴的package包/類
private void createWarpTab(final LayoutInflater inflater, final ViewGroup container, final SeekBar.OnSeekBarChangeListener listener) {
    TabHost.TabSpec spec = mTabHost.newTabSpec(getString(R.string.warp_tab));
    spec.setIndicator(createTabView(inflater, container, getString(R.string.warp_title)));

    spec.setContent(new TabHost.TabContentFactory() {

        @Override
        public View createTabContent(String tag) {

            View view = inflater.inflate(R.layout.fragment_warp, container, false);
            mWarpSeekBar = (RangeSeekBar) view.findViewById(R.id.warp_seekBar);
            mWarpSeekBar.setRange(getResources().getIntArray(R.array.size_seekbar_values));
            mWarpSeekBar.setOnSeekBarChangeListener(listener);

            return (view);
        }
    });
    mTabHost.addTab(spec);
}
 
開發者ID:hollaus,項目名稱:TinyPlanetMaker,代碼行數:20,代碼來源:TabFragment.java

示例4: addTab

import android.widget.TabHost; //導入依賴的package包/類
private static void addTab(MFBMain activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) {
    // Attach a Tab view factory to the spec
    tabSpec.setContent(activity.new TabFactory(activity));
    String tag = tabSpec.getTag();

    // Check to see if we already have a fragment for this tab, probably
    // from a previously saved state.  If so, deactivate it, because our
    // initial state is that a tab isn't shown.
    tabInfo.fragment = activity.getSupportFragmentManager().findFragmentByTag(tag);
    if (tabInfo.fragment != null && !tabInfo.fragment.isDetached()) {
        FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
        ft.detach(tabInfo.fragment);
        ft.commit();
        activity.getSupportFragmentManager().executePendingTransactions();
    }

    tabHost.addTab(tabSpec);
}
 
開發者ID:ericberman,項目名稱:MyFlightbookAndroid,代碼行數:19,代碼來源:MFBMain.java

示例5: onClick

import android.widget.TabHost; //導入依賴的package包/類
@Override
public void onClick(View view) {
    if (AppData.getInstance().hasUserSetServerData()) {
        switch (view.getId()) {
            case btnEmergency:
                sendCommandToRestService("normal");
                break;
            case btnRequestGreenLong:
                sendCommandToRestService("extended");
                break;
        }
        TabHost host = (TabHost) getActivity().findViewById(android.R.id.tabhost);
        host.setCurrentTab(1); //1 = PedestrianTab
    } else {
        final TextView textView = (TextView) this.view.findViewById(R.id.txtView_ErrorMsg);
        textView.setText("set/apply REST server ip:port");
    }
}
 
開發者ID:shreaker,項目名稱:V2I-Traffic-Light-Demonstrator,代碼行數:19,代碼來源:PedestrianTab.java

示例6: addTab

import android.widget.TabHost; //導入依賴的package包/類
public final void addTab(final TabHost.TabSpec tabSpec,
		final Class<?> clss, final Bundle args) {
	tabSpec.setContent(new DummyTabFactory(mContext));
	String tag = tabSpec.getTag();

	TabInfo info = new TabInfo(tag, clss, args);

	if (mAttached) {
		// If we are already attached to the window, then check to make
		// sure this tab's fragment is inactive if it exists. This shouldn't
		// normally happen.
		info.fragment = mFragmentManager.findFragmentByTag(tag);
		if (info.fragment != null && !info.fragment.isDetached()) {
			FragmentTransaction ft = mFragmentManager.beginTransaction();
			ft.detach(info.fragment);
			ft.commit();
		}
	}

	mTabs.add(info);
	addTab(tabSpec);
}
 
開發者ID:CactusSoft,項目名稱:zabbkit-android,代碼行數:23,代碼來源:FixedFragmentTabHost.java

示例7: addTab

import android.widget.TabHost; //導入依賴的package包/類
private void addTab(final TabHost host, final int categoryId) {
    final String tabId = EmojiCategory.getCategoryName(categoryId, 0 /* categoryPageId */);
    final TabHost.TabSpec tspec = host.newTabSpec(tabId);
    tspec.setContent(R.id.emoji_keyboard_dummy);
    final ImageView iconView = (ImageView)LayoutInflater.from(getContext()).inflate(
            R.layout.emoji_keyboard_tab_icon, null);
    // TODO: Replace background color with its own setting rather than using the
    //       category page indicator background as a workaround.
    iconView.setBackgroundColor(mCategoryPageIndicatorBackground);
    iconView.setImageResource(mEmojiCategory.getCategoryTabIcon(categoryId));
    iconView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
    tspec.setIndicator(iconView);
    host.addTab(tspec);
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:15,代碼來源:EmojiPalettesView.java

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

示例9: checkVisualFeedbackTabs

import android.widget.TabHost; //導入依賴的package包/類
private void checkVisualFeedbackTabs()
{
	List<Component> visualFeedbacks = PipelineBuilder.getInstance().getComponentsOfClass(PipelineBuilder.Type.EventHandler, VisualFeedback.class);
	removeComponentsOfClass(additionalTabs, VisualFeedback.class);
	if (!visualFeedbacks.isEmpty())
	{
		boolean anyUnmanaged = false;
		TableLayout visualFeedbackLayout = getTableLayoutForVisualFeedback(visualFeedbacks);
		TabHost.TabSpec newTabSpec = getNewTabSpec(visualFeedbackLayout, visualFeedbacks.get(0).getComponentName(), android.R.drawable.ic_menu_compass); // TODO: Change icon.
		for (Component visualFeedback : visualFeedbacks)
		{
			boolean isManaged = PipelineBuilder.getInstance().isManagedFeedback(visualFeedback);

			if(! isManaged)
			{
				anyUnmanaged = true;
				((VisualFeedback) visualFeedback).options.layout.set(visualFeedbackLayout);
			}
		}
		if(anyUnmanaged)
			additionalTabs.put(visualFeedbacks.get(0), newTabSpec);
	}
}
 
開發者ID:hcmlab,項目名稱:ssj,代碼行數:24,代碼來源:TabHandler.java

示例10: checkCameraPainterTabs

import android.widget.TabHost; //導入依賴的package包/類
private void checkCameraPainterTabs()
{
	List<Component> cameraPainters = PipelineBuilder.getInstance().getComponentsOfClass(PipelineBuilder.Type.Consumer, CameraPainter.class);
	removeObsoleteComponentsOfClass(additionalTabs, cameraPainters, CameraPainter.class);
	for (Component cameraPainter : cameraPainters)
	{
		if (additionalTabs.containsKey(cameraPainter))
		{
			continue;
		}

		SurfaceView surfaceView = ((CameraPainter) cameraPainter).options.surfaceView.get();
		if (surfaceView == null)
		{
			surfaceView = new SurfaceView(activity);
			((CameraPainter) cameraPainter).options.surfaceView.set(surfaceView);
		}
		TabHost.TabSpec tabSpec = getNewTabSpec(surfaceView, cameraPainter.getComponentName(), android.R.drawable.ic_menu_camera);
		additionalTabs.put(cameraPainter, tabSpec);
	}
}
 
開發者ID:hcmlab,項目名稱:ssj,代碼行數:22,代碼來源:TabHandler.java

示例11: checkAnnotationTabs

import android.widget.TabHost; //導入依賴的package包/類
private void checkAnnotationTabs()
{
	List<Component> iFileWriters = PipelineBuilder.getInstance().getComponentsOfClass(PipelineBuilder.Type.Consumer, IFileWriter.class);
	List<Component> trainers = PipelineBuilder.getInstance().getComponentsOfClass(PipelineBuilder.Type.Consumer, Trainer.class);

	if (iFileWriters.isEmpty() && trainers.isEmpty())
	{
		removeComponentsOfClass(firstTabs, AnnotationTab.class);
	}
	else if (!containsOfClass(firstTabs, AnnotationTab.class))
	{
		AnnotationTab annotationTab = new AnnotationTab(activity);
		TabHost.TabSpec annotationTabSpec = getTabSpecForITab(annotationTab);
		firstTabs.put(annotationTab, annotationTabSpec);
	}
	else //Annotation tab is already here, refresh it
	{
		getAnnotation().syncWithModel();
	}
}
 
開發者ID:hcmlab,項目名稱:ssj,代碼行數:21,代碼來源:TabHandler.java

示例12: retrieveImage

import android.widget.TabHost; //導入依賴的package包/類
private void retrieveImage(final ImageNavigator imageNav)
{
       if(mShareActionProvider != null)
       {
           setShareIntent(shareIntent());
       }

	new Thread(new Runnable()
	{
		@Override
		public void run()
		{
			try
			{
				lastImg = e621.post__show(imageNav.getId());
				updateImage(lastImg,(TabHost)findViewById(R.id.tabHost));
			} catch (IOException e)
			{
				e.printStackTrace();

                   updateImage(e621.localGet(imageNav.getId()),(TabHost)findViewById(R.id.tabHost));
			}
		}
	}).start();
}
 
開發者ID:e621Mobile,項目名稱:E621Mobile,代碼行數:26,代碼來源:ImageFullScreenActivity.java

示例13: updateDownload

import android.widget.TabHost; //導入依賴的package包/類
private void updateDownload(final E621Image img, final TabHost tabHost)
{
	ImageView saveButton = (ImageView)tabHost.findViewById(R.id.saveButton);

	downloadEventManager = new DownloadEventManager(saveButton);

	saveButton.setOnClickListener(new View.OnClickListener()
	{
		@Override
		public void onClick(View view)
		{
			download(img);
		}
	});

	new Thread(new Runnable()
	{
		@Override
		public void run()
		{
			e621.bindDownloadState(img.id,downloadEventManager);
		}
	}).start();
}
 
開發者ID:e621Mobile,項目名稱:E621Mobile,代碼行數:25,代碼來源:ImageFullScreenActivity.java

示例14: hideUI

import android.widget.TabHost; //導入依賴的package包/類
public void hideUI()
{
	getWindow().getDecorView().setSystemUiVisibility(getUIInvisible());

	final TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
	final int height = getHeight();

	Animation a = new Animation()
	{
		@Override
		protected void applyTransformation(float interpolatedTime, Transformation t)
		{
			final RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) tabHost.getLayoutParams();
			params.setMargins(0,(int) (height * ((1-TABS_HEIGHT) + (interpolatedTime*TABS_HEIGHT))),0,0);
			tabHost.setLayoutParams(params);
		}
	};

	a.setDuration(300);
	tabHost.startAnimation(a);
	tabHost.invalidate();

	visible = false;
}
 
開發者ID:e621Mobile,項目名稱:E621Mobile,代碼行數:25,代碼來源:ImageFullScreenActivity.java

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


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