Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove HomeAsUpButton arrow from ActionBar Sherlock?

I want to remove from the arrow image from the HomeAsUpButton.

I tried removing the arrow's ImageView from the layout (nothing happens) and also tried using SupportActionBar.SetDisplayHomeAsUpEnabled(false); removes the button functionality entirely.

I'm using johnkil's SideNavigation code. Any suggestions?

Using YouTube's App as example:

enter image description here

like image 613
Ron Avatar asked Apr 16 '13 15:04

Ron


1 Answers

With the ActionBar Sherlock, inside your Activity's onCreate method, you just need to do the following:

getSupportActionBar().setDisplayHomeAsUpEnabled(false);

If the up image does not disappear, it might be something related to the library that you referred. In my app, I use the SlidingMenu library and it works just fine (source: https://github.com/jfeinstein10/SlidingMenu)

EDIT: With the SlidingMenu library, the Activity would look like this:

public class MainAct extends SlidingFragmentActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        // Sliding menu

        // Here I set the menu's layout
        setBehindContentView(R.layout.menu_frame);
        FragmentTransaction t = getSupportFragmentManager().beginTransaction();
        MenuListFrag frag = MenuListFrag.newInstance(getSlidingMenuItems());
        t.replace(R.id.menu_frame, frag);
        t.commit();

        // Customizing the SlidingMenu
        SlidingMenu sm = getSlidingMenu();
        sm.setShadowWidthRes(R.dimen.shadow_width);
        sm.setShadowDrawable(R.drawable.shadow);
        sm.setFadeDegree(0.35f);

        // Hiding the ActionBar's up button
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        getSupportActionBar().setHomeButtonEnabled(true);

    }
}
like image 188
Alesqui Avatar answered Nov 09 '22 21:11

Alesqui