本文整理汇总了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) {
}