How to place ionic tabs at the bottom of the scree

2019-01-31 11:08发布

I created a simple ionic-tabs that shows my icons at the top of the screen. I tried to wrap it in a ionic-footer-bar in order to have it placed at the bottom of the screen with no success. The tabs disappear when I do that. How should I accomplish the looks I want?

<ion-footer-bar>
    <ion-tabs class="tabs-icon-only tabs-stable">
    ...
    </ion-tabs>
</ion-footer-bar>

标签: tabs ionic
8条回答
等我变得足够好
2楼-- · 2019-01-31 11:13
myapp.config(['$ionicConfigProvider', function($ionicConfigProvider) {
    $ionicConfigProvider.tabs.position('bottom'); // other values: top
}]);
查看更多
我想做一个坏孩纸
3楼-- · 2019-01-31 11:15

Since the beta 14 of Ionic (http://blog.ionic.io/the-final-beta/), there are some config variables that now default to their platform values, which means that they will try to behave according to the platform that they are built on. In the case of tabs, for iOS the default is to display on bottom, and Android on top.

You can easily "hard set" the location for all platforms by setting the tabs.position function in the $ionicConfigProvider, inside your config function like this:

MyApp.config(['$ionicConfigProvider', function($ionicConfigProvider) {

    $ionicConfigProvider.tabs.position('bottom'); // other values: top

}]);

You can check documentation here

查看更多
成全新的幸福
4楼-- · 2019-01-31 11:22

Update for Ionic 2, and Ionic 3+:

You have 2 methods to change tab bar position:

Method 1: Use tabsPlacement propertive of <ion-tabs>

<ion-tabs  tabsPlacement='bottom' >
    <ion-tab [root]="rootTab" tabTitle="Home"></ion-tab> 
</ion-tabs>

Method 2: Change config in app.module.ts

@NgModule({
  imports: [
    IonicModule.forRoot(MyApp, {
      tabsPlacement : 'bottom'
    })
  ]
})

See the docs

查看更多
狗以群分
5楼-- · 2019-01-31 11:23

How to place ionic tabs at the bottom of the screen in Ionic 2

For the current version ionic 2.0.0-beta.10.

In app.ts:

ionicBootstrap(MyApp, [], {
  tabbarPlacement: "bottom"
});

See Config

For the soon to be released ionic 2.0.0-beta.11

In app.ts:

ionicBootstrap(MyApp, [], {
  tabsPlacement: "bottom" 
});

Config

查看更多
一夜七次
6楼-- · 2019-01-31 11:27

To place the ionicFramework tabs at the bottom of the screen for android devices just open your app.js file, and under angular.module add the following lines of code:

.config(function($ionicConfigProvider) {
    $ionicConfigProvider.tabs.position('bottom');
})

Hope this will help.

查看更多
兄弟一词,经得起流年.
7楼-- · 2019-01-31 11:27

Placing it in your app.js does the work.

.config(function($ionicConfigProvider) {
    $ionicConfigProvider.tabs.position('bottom');
})

Ionic automatically takes platform configurations into account to adjust things like what transition style to use and whether tab icons should show on the top or bottom.

For example, In the case of tabs, for iOS the default is to display on bottom, and Android on top.

Note1 : It should be noted that when a platform is not iOS or Android, then it’ll default to iOS

Note2 : if you are developing on a desktop browser, it’s going to take on iOS default configs

查看更多
登录 后发表回答