本文整理匯總了Java中android.support.v7.app.ActionBar.Tab方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionBar.Tab方法的具體用法?Java ActionBar.Tab怎麽用?Java ActionBar.Tab使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.app.ActionBar
的用法示例。
在下文中一共展示了ActionBar.Tab方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activty_about);
actionBar = getSupportActionBar();
viewPager = (ViewPager) findViewById(R.id.pager);
TabsPagerAdapter adapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(adapter);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
ActionBar.Tab tabFirst = actionBar.newTab().setText(getString(R.string.about_tab_1)).setTabListener(this);
ActionBar.Tab tabSecond = actionBar.newTab().setText(getString(R.string.about_tab_2)).setTabListener(this);
ActionBar.Tab tabThird = actionBar.newTab().setText(getString(R.string.about_tab_3)).setTabListener(this);
actionBar.addTab(tabFirst);
actionBar.addTab(tabSecond);
actionBar.addTab(tabThird);
actionBar.selectTab(tabFirst);
}
示例2: onTabSelected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabSelected(ActionBar.Tab tab, android.support.v4.app.FragmentTransaction ft) {
// Check if the fragment is already initialized
if (mFragment == null) {
// If not, instantiate and add it to the activity
mFragment = Fragment.instantiate(mActivity, mClass.getName());
mFragment.setRetainInstance(true);
ft.add(R.id.fragment_content, mFragment, mTag);
} else {
// If it exists and not attached, simply attach it in order to
// show it
ft.attach(mFragment);
}
}
示例3: onTabUnselected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabUnselected(ActionBar.Tab tab, android.support.v4.app.FragmentTransaction ft) {
if (mFragment != null) {
// Detach the fragment, because another one is being attached
ft.detach(mFragment);
}
}
示例4: onTabSelected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
// When the given tab is selected, switch to the corresponding page in
// the ViewPager.
mViewPager.setCurrentItem(tab.getPosition());
}
示例5: onTabUnselected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}
示例6: onTabReselected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}
示例7: onTabSelected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
viewPager.setCurrentItem(tab.getPosition());
}
示例8: onTabUnselected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {}
示例9: onTabReselected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {}
示例10: onTabUnselected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}
示例11: onTabReselected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}
示例12: onTabReselected
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onTabReselected(ActionBar.Tab tab, android.support.v4.app.FragmentTransaction ft) {
}