本文整理汇总了Java中android.app.ActionBar.Tab.setTabListener方法的典型用法代码示例。如果您正苦于以下问题:Java Tab.setTabListener方法的具体用法?Java Tab.setTabListener怎么用?Java Tab.setTabListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.ActionBar.Tab
的用法示例。
在下文中一共展示了Tab.setTabListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.app.ActionBar.Tab; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// this.setContentView(R.layout.layout_main);
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(true);
Tab customerTab = actionBar.newTab().setText(
this.getResources().getString(R.string.customer_tab));
final Fragment customerPackageList = new CustomerPackageFragment(this);
customerTab.setTabListener(new PackageTabListener(customerPackageList));
Tab systemTab = actionBar.newTab().setText(
this.getResources().getString(R.string.system_tab));
final Fragment systemPackageList = new SystemPackageFragment(this);
systemTab.setTabListener(new PackageTabListener(systemPackageList));
actionBar.addTab(customerTab);
actionBar.addTab(systemTab);
}
示例2: addTab
import android.app.ActionBar.Tab; //导入方法依赖的package包/类
public void addTab(Tab tab, Class<?> clss, Event event){
TabInfo info = new TabInfo(clss, event);
tab.setTag(info);
tab.setTabListener(this);
mTabs.add(info);
mFragments.add(EventFragment.newInstance(event));
mActionBar.addTab(tab);
notifyDataSetChanged();
}
示例3: onCreate
import android.app.ActionBar.Tab; //导入方法依赖的package包/类
@Override
protected final void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Tab listAdapterTab = actionBar.newTab().setText(R.string.list_adapter);
Tab singleChoiceListAdapterTab =
actionBar.newTab().setText(R.string.single_choice_list_adapter);
Tab multipleChoiceListAdapterTab =
actionBar.newTab().setText(R.string.multiple_choice_list_adapter);
Tab expandapleListAdapterTab =
actionBar.newTab().setText(R.string.expandable_list_adapter);
Tab singleChoiceExpandableListAdapterTab =
actionBar.newTab().setText(R.string.single_choice_expandable_list_adapter);
Tab multipleChoiceExpandableListAdapterTab =
actionBar.newTab().setText(R.string.multiple_choice_expandable_list_adapter);
Tab recyclerViewListAdapterTab =
actionBar.newTab().setText(R.string.recycler_view_list_adapter);
listAdapterTab.setTabListener(new TabListener(ListAdapterFragment.class));
singleChoiceListAdapterTab
.setTabListener(new TabListener(SingleChoiceListAdapterFragment.class));
multipleChoiceListAdapterTab
.setTabListener(new TabListener(MultipleChoiceListAdapterFragment.class));
expandapleListAdapterTab
.setTabListener(new TabListener(ExpandableListAdapterFragment.class));
singleChoiceExpandableListAdapterTab.setTabListener(
new TabListener(SingleChoiceExpandableListAdapterFragment.class));
multipleChoiceExpandableListAdapterTab.setTabListener(
new TabListener(MultipleChoiceExpandableListAdapterFragment.class));
recyclerViewListAdapterTab
.setTabListener(new TabListener(RecyclerViewListAdapterFragment.class));
actionBar.addTab(listAdapterTab);
actionBar.addTab(singleChoiceListAdapterTab);
actionBar.addTab(multipleChoiceListAdapterTab);
actionBar.addTab(expandapleListAdapterTab);
actionBar.addTab(singleChoiceExpandableListAdapterTab);
actionBar.addTab(multipleChoiceExpandableListAdapterTab);
actionBar.addTab(recyclerViewListAdapterTab);
}
}