本文整理匯總了Java中android.support.v7.app.ActionBar.Tab.setTabListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Tab.setTabListener方法的具體用法?Java Tab.setTabListener怎麽用?Java Tab.setTabListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.app.ActionBar.Tab
的用法示例。
在下文中一共展示了Tab.setTabListener方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setActionBar
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
private void setActionBar() {
actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
// actionBar.setTitle(getResources().getString(R.string.str_title_contacts_manager));
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Tab contactsTab = actionBar.newTab();
contactsTab.setText(getString(R.string.str_contacts));
contactsTab.setTabListener(contactsTabListener);
actionBar.addTab(contactsTab);
Tab groupsTab = actionBar.newTab();
groupsTab.setText(getString(R.string.str_lists));
groupsTab.setTabListener(groupsTabListener);
actionBar.addTab(groupsTab);
}
示例2: configureTabNavigation
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
/**
* Configures the {@link ActionBar} to display navigation tabNames.
*
* @param actionBar the {@link ActionBar} to customize.
* @param names the collection of tab names.
* @param listener the {@link TabListener} to handle tab selection events.
*/
public static void configureTabNavigation(final ActionBar actionBar, final List<String> names,
final TabListener listener) {
if (listener == null) {
throw new IllegalArgumentException("TabListener must be supplied");
}
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
for (final String name : names) {
final Tab tab = actionBar.newTab();
tab.setTabListener(listener);
tab.setText(name);
actionBar.addTab(tab);
}
}
示例3: addTab
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
private void addTab(String tag){
Tab tab = mActionBar.newTab();
tab.setTag(tag);
tab.setText(tag);
tab.setTabListener(new TabFragmentListener<TabFragment>(this, tag, TabFragment.class));
mActionBar.addTab(tab);
}
示例4: addTab
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
private void addTab(String tag){
Tab tab = mActionBar.newTab();
tab.setTag(tag);
tab.setIcon(R.drawable.ic_action_search);
tab.setText(tag);
tab.setTabListener(new TabFragmentListener<TabFragment>(this, tag, TabFragment.class));
mActionBar.addTab(tab);
}
示例5: addTab
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
public void addTab(Tab tab, Class<?> clss, Bundle args) {
TabInfo info = new TabInfo(clss, args);
tab.setTag(info);
tab.setTabListener(this);
mTabs.add(info);
notifyDataSetChanged();
mActionBar.addTab(tab);
}
示例6: makeActionBarTab
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
protected Tab makeActionBarTab(TabInfo tabInfo) {
Tab tab = mActionBar.newTab();
tab.setText(tabInfo.mTitle);
tab.setTabListener(mAdapter);
return tab;
}
示例7: onCreate
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Set global context
Globals.setContext(getApplicationContext());
// Set up the action bar.
final ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
viewPager = (ViewPager)findViewById(R.id.main_pager);
viewPager.setAdapter(sectionsPagerAdapter);
// When swiping between different sections, select the corresponding
// tab. We can also use ActionBar.Tab#select() to do this if we have
// a reference to the Tab.
viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener()
{
@Override
public void onPageSelected(int position)
{
actionBar.setSelectedNavigationItem(position);
}
});
Tab cleanTab = actionBar.newTab();
cleanTab.setText(CLEAN_TAB_TITLE);
cleanTab.setTabListener(this);
actionBar.addTab(cleanTab);
Tab profileTab = actionBar.newTab();
profileTab.setText(PROFILE_TAB_TITLE);
profileTab.setTabListener(this);
actionBar.addTab(profileTab);
}