Android: getSupportActionBar() always returns null in ActionBarSherlock library

前端 未结 14 718
盖世英雄少女心
盖世英雄少女心 2020-11-29 05:29

I\'m trying to use the ActionBarSherlock library to provide backwards compatible ActionBar support with tabs in my Android app, so I downloaded the latest build, built the d

14条回答
  •  难免孤独
    2020-11-29 06:24

    I had the same problem on the Android ICS 4.0.4. I was using requestWindowFeature(Window.FEATURE_NO_TITLE); on the FragmentActivity, but this was hiding the ActionBar on ICS+ devices that caused the getSupportActionBar() to be null.

    Simply removed the:
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    And it worked like a charm.

    Hope it helps someone.

提交回复
热议问题