aletede91
aletede91

Reputation: 1166

Make app icon clickable without back icon

Can i make my Action Bar app icon clickable without displaying the back icon?

This is my code, it works, I have only layout problem:

actionBar.setDisplayHomeAsUpEnabled(true);

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        //Do stuff
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

This is my activity layout, what I want is remove back icon, is it possible?

enter image description here

Upvotes: 0

Views: 116

Answers (1)

michal.z
michal.z

Reputation: 2075

Try to use setHomeButtonEnabled(boolean enabled) instead of setDisplayHomeAsUpEnabled(boolean enabled). The latter do exactly the same thing as former which is enabling home button but additionally put up affordance sign which you want to get rid off.

Upvotes: 2

Related Questions