I am trying to display the title of the toolbar in the center, and for this I am using the method that is indicated in this answer: - Name of the toolbar
However, when I include the return button in my with the activityfollowing code:
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mActionBar = getSupportActionBar();
mActionBar.setDisplayHomeAsUpEnabled(true);
mActionBar.setDisplayShowHomeEnabled(true);
The toolbar name does not appear in the center, but is slightly off-center to the right.
How can I get a centered title without that affects the back button or menu bar?
source
share