0
我正在使用ActionBarSherlock库的项目。现在我想用viewpager创建选项卡。ActionBarTabs在片段类而不是活动
所以我用this教程作为参考。我想创建tabview的类是Fragment
,而不是Activity
。
有人请帮助我将Activity
类中使用的这些方法转换为Fragment
的方法。
第一:
ActionBar actionBar = getSupportActionBar();
Error:The method getSupportActionBar() is undefined for the type Fragment
二:
viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));
Error:The method getSupportFragmentManager() is undefined for the type Fragment
好像你没有使用支持库,所以只需从api中删除所有'support',我想你的'minSDKVersion'> = 11 – Xcihnegn 2015-03-25 09:13:30