Ionic framework 如何在Ionic应用程序上居中标题

Ionic framework 如何在Ionic应用程序上居中标题,ionic-framework,Ionic Framework,我使用的是图标1,我想在标题中居中显示“我的帐户”。我查看了文档并尝试了代码,但它将内容放在了内容窗格中 这是我目前得到的代码,它在顶部显示“MyAccount”: 我的帐户 我想我需要在某处添加指令。我试着添加它,但没有达到预期效果 有人能建议怎么做吗 要在Ionic Angular中使用动态标题栏行为,请使用指令: <ion-header-bar title="MyAccount" left-buttons="leftButtons" right-buttons="ri

我使用的是图标1,我想在标题中居中显示“我的帐户”。我查看了文档并尝试了代码,但它将内容放在了内容窗格中

这是我目前得到的代码,它在顶部显示“MyAccount”:


我的帐户
我想我需要在某处添加
指令。我试着添加它,但没有达到预期效果

有人能建议怎么做吗


要在Ionic Angular中使用动态标题栏行为,请使用
指令:

<ion-header-bar
  title="MyAccount"
  left-buttons="leftButtons"
  right-buttons="rightButtons"
  type="bar-positive"
  align-title="center">
</ion-header-bar>

资料来源:

例如:

<ion-header-bar align-title="center" class="bar-positive">
  <div class="buttons">
    <button class="button" ng-click="doSomething()">Left Button</button>
  </div>
  <h1 class="title">MyAccount</h1>
  <div class="buttons">
    <button class="button">Right Button</button>
  </div>
</ion-header-bar>
<ion-content class="has-header">
  Some content!
</ion-content>

左键
我的帐户
右键
一些内容!
<ion-header-bar align-title="center" class="bar-positive">
  <div class="buttons">
    <button class="button" ng-click="doSomething()">Left Button</button>
  </div>
  <h1 class="title">MyAccount</h1>
  <div class="buttons">
    <button class="button">Right Button</button>
  </div>
</ion-header-bar>
<ion-content class="has-header">
  Some content!
</ion-content>