SherlockFragmentActivity上的requestWindowFeature

时间:2013-03-13 12:18:09

标签: android android-actionbar actionbarsherlock

它在此行显示NullPointerException

bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

我猜我在确切位置使用了requestWindowFeature

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(com.actionbarsherlock.view.Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);


    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.pager);

    setContentView(mViewPager);

    ActionBar bar = getSupportActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    mTabsAdapter = new TabsAdapter(this, mViewPager);

    mTabsAdapter.addTab(bar.newTab().setText("Featured"),
            EventsFeatured.class, null);
    mTabsAdapter.addTab(bar.newTab().setText("All"), EventsAll.class, null);
    mTabsAdapter.addTab(bar.newTab().setText("Nearby"), EventsNearBy.class,
            null);

}

您可以在http://pastebin.com/74a8shqs

找到完整的代码

logcat的: enter image description here

0 个答案:

没有答案