本文整理匯總了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();
}
示例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);
}
示例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);
}
示例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);
}
示例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");
}
}
示例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);
}
示例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);
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
示例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();
}
示例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;
}
示例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