Ionic Default Style Android and iOS diff

Source: Internet
Author: User

There are some different places in the default styles for Android and iOS in Ionicframework, which are documented in official documents, but often can't be missed.

First, the difference:

1.tab position, $ionicConfigProvider, tabs.position (value)

Android default is top, iOS is bottom (bottom)

2. Title Android default on the left, iOS default center

Navbar.aligntitle (value)

Two: Solutions:

1. The tab default setting for Android is displayed at the bottom:

Modify the App.js file as follows:

. config (function ($stateProvider, $urlRouterProvider, $ionicConfigProvider) {//Modify The tabs of Android display position! start  $ionicConfigProvider. Platform.ios.tabs.style (' standard ');  $ionicConfigProvider. Platform.ios.tabs.position (' bottom ');  $ionicConfigProvider. Platform.android.tabs.style (' standard ');  $ionicConfigProvider. Platform.android.tabs.position (' standard ');  $ionicConfigProvider. Platform.ios.navBar.alignTitle (' center ');  $ionicConfigProvider. Platform.android.navBar.alignTitle (' left ');  $ionicConfigProvider. Platform.ios.backButton.previousTitleText ('). Icon (' Ion-ios-arrow-thin-left ');  $ionicConfigProvider. Platform.android.backButton.previousTitleText ('). Icon (' Ion-android-arrow-back ');  $ionicConfigProvider. Platform.ios.views.transition (' iOS ');  $ionicConfigProvider. Platform.android.views.transition (' Android '); //Modify The tabs of Android display position! end//Ionic uses Angularui Router which uses the concept of States//Learn more here:Https://github.com/angular-ui/ui-router  //Set up the various states which the app can is in. //Each state ' s controller can be found in Controllers.js$stateProvider//Setup an abstract state for the tabs Directive. State ('Tab', {URL:'/tab',    Abstract:true, Templateurl:'templates/tabs.html'  })  //Each tab has a own NAV history stack:. State ('Tab.dash', {URL:'/dash', Views: {'Tab-dash': {templateurl:'templates/tab-dash.html', Controller:'Dashctrl'}} ). State ('Tab.chats', {URL:'/chats', Views: {'Tab-chats': {templateurl:'templates/tab-chats.html', Controller:'Chatsctrl'}} ). State ('Tab.chat-detail', {URL:'/chats/:chatid', Views: {'Tab-chats': {templateurl:'templates/chat-detail.html', Controller:'Chatdetailctrl'}} ). State ('Tab.account', {URL:'/account', Views: {'Tab-account': {templateurl:'templates/tab-account.html', Controller:'Accountctrl'      }    }  }); //If none of the above states is matched, use this as the fallback$urlRouterProvider. Otherwise ('/tab/dash');});

2. Change the title style of Android to center display

Set the align-title= "Center" property on the command Ion-header-bar.

Ionic Default Style Android and iOS diff

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.