Android: getSupportActionBar() always returns null in ActionBarSherlock library

前端 未结 14 696
盖世英雄少女心
盖世英雄少女心 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:25

    whenever we set customview using sherlock library. just remove this requestWindowFeature(Window.FEATURE_NO_TITLE); like this we make customview using sherlock bar library..

                getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); 
        getSupportActionBar().setCustomView(R.layout.header_sherlock_xmllayout);
        header_tvleft = (TextView) findViewById(R.id.header_tvleft);
        header_tvleft.setText("Back");
    

提交回复
热议问题