Using support action bar home enabled

后端 未结 5 2249
花落未央
花落未央 2021-02-08 13:31

I\'ve just modified our code to use the new SupportActionBar provided in the v7-appcompat library but when running the code on a Jellybean phone (presumably the same problem exi

5条回答
  •  心在旅途
    2021-02-08 13:54

    Try use Sherlock library for android devices such as Gingerbread cos android action bars is only supported from 3.0 upwards so the sherlock lock library gives you backward compatibility.

    http://actionbarsherlock.com/ --- download library here.

    Then add this lines in your code.

    ActionBar actionBar = getSupportActionBar();
            actionBar.setDisplayHomeAsUpEnabled(true);
             actionBar.setIcon(android.R.color.transparent);
    
            actionBar.setDisplayUseLogoEnabled(false);
    

    This would help you to add a back home key in your action bar. It would also make your icon invisible if you dont want it to show. But if you want your app icon show on all activity simply comment this line below

    actionBar.setIcon(android.R.color.transparent);

提交回复
热议问题