离子导航栏:标题不在Android设备上居中 [英] Ionic nav-bar: Title is not centered on Android Device
问题描述
我对Ionic非常陌生,但我已经喜欢上它了.我想使用nav-bar
,所以我实现了以下index.html:
Im very new to Ionic but i already like it. I wanted to use the nav-bar
so i implemented the following index.html:
<!DOCTYPE html>
<html data-ng-app="myApp">
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<!-- Ionic -->
<link rel="stylesheet" type="text/css" href="lib/ionic/css/ionic.css">
<script type="text/javascript" src="lib/ionic/js/ionic.bundle.js"></script>
<!-- myApp -->
<link rel="stylesheet" type="text/css" href="css/general.css">
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/factory.js"></script>
<script type="text/javascript" src="js/controller.js"></script>
</head>
<body>
<ion-nav-bar class="bar-positive">
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view></ion-nav-view>
</body>
</html>
在我的app.js中,我配置路径:
In my app.js i configure the pathing:
var myApp = angular.module('myApp', ['ionic']);
myApp.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider.state('index', {
url: '/',
templateUrl: 'views/home.html'
}).state('prints', {
url: '/prints',
templateUrl: 'views/photo_prints.html'
}).state('box', {
url: '/box',
templateUrl: 'views/photo_box.html'
});
$urlRouterProvider.otherwise("/");
});
还有一个示例页面:
<ion-view view-title="Home">
<ion-content ng-controller="HomeController">
<a href="#/prints">Prints</a></br></br>
<a href="#/box">Box</a></br></br>
</ion-content>
</ion-view>
当我在我的PC上的Google chrome浏览器中测试所有内容时,一切看起来都应该正常.标题居中.
When i test everything in my google chrome browser on my pc everything looks like it should. The title is centered.
当我现在在我的android设备上测试它(据我所知,它也应该使用google chrome)时,我得到以下结果:
When i now test it on my android device (which should also use google chrome as i know), i get the following result:
您可以看到标题未居中.我该如何解决? 不幸的是,我没有其他设备可以对其进行测试.
As you can see the Title is not centered. How can i fix that? Unfortunately i have no other device to test it.
推荐答案
尝试在您的ion-nav-bar中添加align-title="center"
属性
Try add the align-title="center"
attribute in your ion-nav-bar
<ion-nav-bar class="bar-positive" align-title="center">
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
这篇关于离子导航栏:标题不在Android设备上居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!