如何拉伸md-nav-item元素

pic1
------------------------------------------------
| ITEM1 | ITEM 2 |
------------------------------------------------

pic 2
------------------------------------------------
|         ITEM1        |          ITEM 2       |
------------------------------------------------


这是我正在使用的示例代码

<div>
<md-content class="md-padding" >
    <md-nav-bar md-selected-nav-item="currentNavItem" nav-bar-aria-label="navigation links">
    <md-nav-item md-nav-href="#activity" name="activity">Activity</md-nav-item>
    <md-nav-item md-nav-href="#feeds" name="feeds">Feeds</md-nav-item>
    </md-nav-bar>
</md-content>
</div>

最佳答案

您可以通过设置

 <div layout="row" layout-align="center" flex="50">


演示



<html>

<head>
  <title>angular material switch</title>
  <link rel="stylesheet" href="//rawgit.com/angular/bower-material/master/angular-material.css">
</head>

<body>
  <div ng-app="app" ng-controller="ctrl">
    <div>
      <md-content class="md-padding">
        <md-nav-bar md-selected-nav-item="currentNavItem" nav-bar-aria-label="navigation links">
          <div layout="row" layout-align="center" flex="50">
          <md-nav-item md-nav-href="#activity" name="activity">Activity</md-nav-item>
          </div>
          <div layout="row" layout-align="center" flex="50">
          <md-nav-item md-nav-href="#feeds" name="feeds">Feeds</md-nav-item>
          </div>
        </md-nav-bar>
      </md-content>
    </div>

  </div>


  <!-- Angular Material Dependencies -->
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.js"></script>
  <script src="//cdn.jsdelivr.net/hammerjs/2.0.4/hammer.min.js"></script>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-animate.min.js"></script>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-aria.min.js"></script>

  <!-- Angular Material Javascript now available via Google CDN; version 0.6 used here -->
  <script src="//rawgit.com/angular/bower-material/master/angular-material.min.js"></script>


  <script>
    var app = angular.module('app', ['ngMaterial']);

    app.controller("ctrl", function($scope) {
      $scope.toggle = false;
      $scope.selectedIndex = 0;
    });
  </script>
</body>

</html>

10-04 15:58