本文整理汇总了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();
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}