Java – remove the back arrow button from the action bar
•
Java
In my android project, whenever I go from first activity to second, I get a left arrow button, followed by some text in the action bar The left arrow only appears when I set the first activity as the hierarchical parent of the second activity
I want to delete the back button and replace it with an icon I've read other posts on the same issue, so I've tried the following code in the oncreate () method
getActionBar().setDisplayHomeAsUpEnabled(false);
But after reaching the second activity, the application crashed
Please help me
Solution
Use the getsupportactionbar() column:
getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setHomeButtonEnabled(false);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码