- 教程
- 概述
- 环境设置(Environment Setup)
- 自动完成(Autocomplete)
- 角材料 - 底板(Bottom Sheet)
- Cards
- 小部件(Widgets)
- 布局(Layouts)
- 输入(Inputs)
- Icons
- Grids
- SideNav(SideNav)
- Fab 速拨号(Fab Speed Dial)
- 子头(Subheaders)
- Swipe
- 开关(Switches)
- 主题(Themes)
- 祝酒词(Toasts)
- 排版(Typography)
- 虚拟重复(Virtual Repeat)
- 白色框架(WhiteFrame)
- 有用的资源
- Buttons
- CheckBoxes
- Content
- DatePicker
- Dialogs
- Divider
- List
- Menu
- Menu Bar
- Progress Bars
- Radio Buttons
- Selects
- ListBox和ListCtrl(ListBox & ListCtrl)
- Sliders
- Tabs
- Toolbars
- Tooltips
- Chips
- Contact Chips
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
布局(Layouts)
布局指令
容器元素上的布局指令用于指定其子元素的布局方向。 以下是布局指令的可分配值 -
row - 项目水平排列,max-height = 100%,max-width是容器中项目的宽度。
column - 项目垂直排列,max-width = 100%,max-height是容器中项目的高度。
对于响应式设计(例如根据设备屏幕大小自动更改布局),下表中列出的布局API可用于设置具有视图宽度的设备的布局方向。
Sr.No | 断点覆盖默认值时的API和设备宽度 |
---|---|
1 | layout 设置默认布局方向,除非被另一个断点覆盖。 |
2 | layout-xs 宽度<600px |
3 | layout-gt-xs 宽度> = 600px |
4 | layout-sm 600px <=宽度<960px |
5 | layout-gt-sm 宽度> = 960px |
6 | layout-md 960px <=宽度<1280px |
7 | layout-gt-md 宽度> = 1280px |
8 | layout-lg 1280px <=宽度<1920px |
9 | layout-gt-lg 宽度> = 1920px |
10 | layout-xl 宽度> = 1920px |
例子 (Example)
以下示例显示了layout指令的使用以及布局的用法。
am_layouts.htm
<html lang = "en">
<head>
<link rel = "stylesheet"
href = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
<link rel = "stylesheet" href = "https://fonts.googleapis.com/icon?family=Material+Icons">
<style>
.box {
color:white;
padding:10px;
text-align:center;
border-style: inset;
}
.green {
background:green;
}
.blue {
background:blue;
}
</style>
<script language = "javascript">
angular
.module('firstApplication', ['ngMaterial'])
.controller('layoutController', layoutController);
function layoutController ($scope) {
}
</script>
</head>
<body ng-app = "firstApplication">
<div id = "layoutContainer" ng-controller = "layoutController as ctrl"
style = "height:100px;" ng-cloak>
<div layout = "row" layout-xs = "column">
<div flex class = "green box">Row 1: Item 1</div>
<div flex = "20" class = "blue box">Row 1: Item 2</div>
</div>
<div layout = "column" layout-xs = "column">
<div flex = "33" class = "green box">Column 1: item 1</div>
<div flex = "66" class = "blue box">Column 1: item 2</div>
</div>
</div>
</body>
</html>
Flex指令
容器元素上的flex指令用于自定义元素的大小和位置。 它定义了元素相对于其父容器和容器中其他元素的大小调整方式。 以下是flex指令的可分配值 -
multiples of 5 - 5,10,15 ... 100的multiples of 5
33 - 33%
66 - 66%
例子 (Example)
以下示例显示了flex指令的使用以及flex的用法。
am_flex.htm
<html lang = "en">
<head>
<link rel = "stylesheet"
href = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
<link rel = "stylesheet" href = "https://fonts.googleapis.com/icon?family=Material+Icons">
<style>
.box {
color:white;
padding:10px;
text-align:center;
border-style: inset;
}
.green {
background:green;
}
.blue {
background:blue;
}
</style>
<script language = "javascript">
angular
.module('firstApplication', ['ngMaterial'])
.controller('layoutController', layoutController);
function layoutController ($scope) {
}
</script>
</head>
<body ng-app = "firstApplication">
<div id = "layoutContainer" ng-controller = "layoutController as ctrl"
layout = "row" style = "height:100px;" ng-cloak layout-wrap>
<div flex = "30" class = "green box">
[flex = "30"]
</div>
<div flex = "45" class = "blue box">
[flex = "45"]
</div>
<div flex = "25" class = "green box">
[flex = "25"]
</div>
<div flex = "33" class = "green box">
[flex = "33"]
</div>
<div flex = "66" class = "blue box">
[flex = "66"]
</div>
<div flex = "50" class = "blue box">
[flex = "50"]
</div>
<div flex class = "green box">
[flex]
</div>
</div>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论