【问题标题】:How to centre ionic-icon in Ionic app when ion-text-centre is not working?当离子文本中心不起作用时,如何在离子应用程序中居中离子图标?
【发布时间】:2020-06-21 13:35:42
【问题描述】:

我试图在我的 Ionic 应用中将 ion-icon 居中,我尝试使用 ion-text-center 类 I从 ionic 文档 here 获得,但它没有呈现任何变化。

这是我的代码:

<ion-header [translucent]="true">

    <ion-toolbar color="danger">
        <ion-title>
          Feedly
        </ion-title>
    </ion-toolbar>

</ion-header>

<ion-content [fullscreen]="true">


    <ion-item class="ion-text-center">
        <ion-icon name="logo-rss" class="logo" color="light"></ion-icon>
    </ion-item> 

</ion-content>

谁能告诉我我做错了什么,以及如何解决这个问题?

【问题讨论】:

  • 你应该考虑使用 ion-grid

标签: ionic-framework


【解决方案1】:

这应该适合你

      <ion-grid>
        <ion-row>
          <ion-col size="12" text-center>
            <ion-item>
             <ion-icon name="logo-rss"></ion-icon>
            </ion-item>
           </ion-col>
          </ion-row>
        </ion-grid> 

基本上你想使用图标网格来控制列和行内的布局和放置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-18
    • 2018-03-01
    • 1970-01-01
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多