Ionic nav-bar: Title is not centered on Android Device

后端 未结 9 1025
别跟我提以往
别跟我提以往 2021-02-01 17:20

Im very new to Ionic but i already like it. I wanted to use the nav-barso i implemented the following index.html:




        
9条回答
  •  抹茶落季
    2021-02-01 17:42

    I tried many of the solutions listed here and still had the following 2 issues with native Android builds:

    1. The title text either getting shifted off the left side of the screen or just plain not appearing at all
    2. The title text not being vertically centered in the nav bar

    The following CSS resolved both of these issues for me:

    .platform-android .bar .title {
        line-height: 52px !important;  // vertically centers title on native Android builds
    }
    
    .bar .title {
        position: absolute;
        left: 0px !important;
        right: 0px !important;
        width: 100%;
        text-align: center !important;
        margin-left: 0px !important;
        margin-right: 0px !important;
    }
    

提交回复
热议问题