我使用了需要AppCompatActivity类的工具栏,之前我使用了FragmentActivity,所以我也无法扩展AppCompatActivity
使用从AppCompatActivity继承的setSupportActinBar的解决方案是什么
这是我的代码
public class currentActivity extends FragmentActivity implements
TabHost.OnTabChangeListener, ViewPager.OnPageChangeListener{
private Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.current);
mToolbar = (Toolbar) findViewById(R.id.ctoolbar);
//setSupportActionBar(mToolbar); //problem is here
//getSupportActionBar().setDisplayShowHomeEnabled(true);
initialiseTabHost(savedInstanceState);
intialiseViewPager();
if (savedInstanceState != null) {
mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); //set the tab as per the saved state
}
}