Is there a way to make ion-segment look the same on both iOS and Android?

不打扰是莪最后的温柔 提交于 2020-01-03 19:31:11

问题


After setting the mode of ion-segment, they still look different after rendering them in ionic lab.

I have tried setting the mode of ion-segment and ion-toolbar to "md" but they still look different.

https://ibb.co/HV75Ly2 Here is an image of what they look like after setting the mode.

<ion-toolbar mode="md">
    <ion-segment scrollable mode="md">
      <ion-segment-button value="top" checked>
        TOP
      </ion-segment-button>
      <ion-segment-button value="nfl">
        NFL
      </ion-segment-button>
      <ion-segment-button value="nba">
        NBA
      </ion-segment-button>
      <ion-segment-button value="mlb">
        MLB
      </ion-segment-button>
      <ion-segment-button value="nhl">
        NHL
      </ion-segment-button>
      <ion-segment-button value="ncaaf">
        NCAAF
      </ion-segment-button>
      <ion-segment-button value="ncaab">
        NCAAB
      </ion-segment-button>
    </ion-segment>
</ion-toolbar>

I would like the ion-segment to look like the android version on both platforms but currently, they still look different.


回答1:


Since one of the Ionic 4 beta's you also have to set mode on every component.

This means the ion-segment-button components as well, like:

<ion-toolbar mode="md">
    <ion-segment scrollable mode="md">
      <ion-segment-button mode="md" value="top" checked>
        TOP
      </ion-segment-button>
      <ion-segment-button mode="md" value="nfl">
        NFL
      </ion-segment-button>
      <ion-segment-button mode="md" value="nba">
        NBA
      </ion-segment-button>
      <ion-segment-button mode="md" value="mlb">
        MLB
      </ion-segment-button>
      <ion-segment-button mode="md" value="nhl">
        NHL
      </ion-segment-button>
      <ion-segment-button mode="md" value="ncaaf">
        NCAAF
      </ion-segment-button>
      <ion-segment-button mode="md" value="ncaab">
        NCAAB
      </ion-segment-button>
    </ion-segment>
</ion-toolbar>


来源:https://stackoverflow.com/questions/57335004/is-there-a-way-to-make-ion-segment-look-the-same-on-both-ios-and-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!