Android dashboard: disable action

We have an application similar to the file manager, in which we use the main button of the action bar as the "go to 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 in a subfolder. When we get to the top folder, we will turn off the display.

// Update home actionBar.setDisplayHomeAsUpEnabled(hasParent); 

the problem is that the button is still β€œon” in that the user can click it, can see the visual feedback that has been clicked. we want the action bar home button in this case to be completely disabled when the parent folder is missing.

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

any ideas? thanks.

+6
source share
1 answer

Have you tried setHomeButtonEnabled() ? This is new to API Level 14, so you'll have to skip it for cell tablets.

+19
source

Source: https://habr.com/ru/post/917386/


All Articles