Ionic 4 ion-title in toolbar is not centered on android
I have tested the followings on my android and the title is centered with other buttons such as back button, etc.
Not too sure if it works on iOS devices
Hopefully this helps:
<ion-toolbar>
<ion-title style="width: 100%; position: absolute; left: 0; height: 0;">
Title
</ion-title>
</ion-toolbar>
Ionic v4 keeps toolbar title on left for android devices and on center for IOS devices.
To use a particular behavior you can use mode="md|ios"
. md is for android and ios for IOS devices.
Since you want to make the title on center, you can use mode="ios"
which will make the toolbar title to be on center for both android and ios devices.
This is my header:
<ion-header>
<ion-toolbar mode="ios">
<ion-title>
Add New Rest
</ion-title>
<ion-icon slot="end" name="analytics"></ion-icon>
<ion-buttons slot="start">
<ion-buttons slot="start">
<ion-back-button defaultHref="home"></ion-back-button>
</ion-buttons>
</ion-buttons>
</ion-toolbar>
</ion-header>
Have a look at the screenshot below