Jeffrey Blattman
Jeffrey Blattman

Reputation: 22637

android: disable action bar home button

We have a file manager-like application where we use the action bar home button as a "go up in the folder structure" action. If the user is at the top of the folder structure, the button should be disabled.

We set the home button as up when the user is within a sub folder. Shen we reach the top folder, we disable showing as up.

    // Update home
    actionBar.setDisplayHomeAsUpEnabled(hasParent);

the problem is that the button is still "enabled" in that the user can press it can see visual feedback that is was pressed. we want the action bar home button to be completely disabled in this case, when there is no parent folder.

I tried calling setDisplayShowHomeEnabled(), but does not disable the button but in stead this removes the home button completely.

Any ideas?

Upvotes: 5

Views: 6984

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006779

Did you try setHomeButtonEnabled()? That is new to API Level 14, so you would have to skip it for Honeycomb tablets.

Upvotes: 18

Related Questions