Skip to content

Commit

Permalink
merge material and inporving-layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
kesenhoo committed Mar 14, 2015
2 parents bfd6b6a + 4dcc1ae commit bf098e6
Show file tree
Hide file tree
Showing 16 changed files with 109 additions and 354 deletions.
252 changes: 0 additions & 252 deletions manifest.appcache
Original file line number Diff line number Diff line change
Expand Up @@ -2,258 +2,6 @@ CACHE MANIFEST
# Revision 1407253957629

CACHE:
building-wearables.html
index.html
animations/cardflip.html
animations/crossfade.html
animations/index.html
animations/layout.html
animations/screen-slide.html
animations/zoom.html
background-jobs/load-data-background/handle-result.html
background-jobs/load-data-background/index.html
background-jobs/load-data-background/setup-loader.html
background-jobs/run-background-service/create-service.html
background-jobs/run-background-service/index.html
background-jobs/run-background-service/report-status.html
background-jobs/run-background-service/send-request.html
background-jobs/scheduling/alarms.html
background-jobs/scheduling/index.html
background-jobs/scheduling/wake-lock.html
basics/actionbar/adding-buttons.html
basics/actionbar/index.html
basics/actionbar/overlaying.html
basics/actionbar/setting-up.html
basics/actionbar/styling.html
basics/activity-lifecycle/index.html
basics/activity-lifecycle/pausing.html
basics/activity-lifecycle/recreating.html
basics/activity-lifecycle/starting.html
basics/activity-lifecycle/stopping.html
basics/data-storage/database.html
basics/data-storage/files.html
basics/data-storage/index.html
basics/data-storage/shared-preference.html
basics/firstapp/building-ui.html
basics/firstapp/creating-project.html
basics/firstapp/index.html
basics/firstapp/running-app.html
basics/firstapp/starting-activity.html
basics/fragments/communicating.html
basics/fragments/creating.html
basics/fragments/fragment-ui.html
basics/fragments/index.html
basics/index.html
basics/intents/filters.html
basics/intents/index.html
basics/intents/result.html
basics/intents/sending.html
basics/supporting-devices/index.html
basics/supporting-devices/languages.html
basics/supporting-devices/platforms.html
basics/supporting-devices/screens.html
best-background.html
best-performance.html
best-security.html
best-testing.html
best-user-input.html
best-ux.html
building-connectivity.html
building-content-sharing.html
building-graphics.html
building-multimedia.html
building-userinfo.html
cloud/cloudsave/index.html
cloud/cloudsync/backupapi.html
cloud/cloudsync/gcm.html
cloud/cloudsync/index.html
connectivity/connect-devices-wireless/index.html
connectivity/connect-devices-wireless/nsd-wifi-index.html
connectivity/connect-devices-wireless/nsd.html
connectivity/connect-devices-wireless/wifi-direct.html
connectivity/efficient-downloads/connectivity-patterns.html
connectivity/efficient-downloads/efficient-network-access.html
connectivity/efficient-downloads/index.html
connectivity/efficient-downloads/redundant-redundant.html
connectivity/efficient-downloads/regular-update.html
connectivity/network-ops/connecting.html
connectivity/network-ops/managing.html
connectivity/network-ops/index.html
connectivity/network-ops/xml.html
connectivity/sync-adapters/create-authenticator.html
connectivity/sync-adapters/create-stub-provider.html
connectivity/sync-adapters/create-sync-adapter.html
connectivity/sync-adapters/index.html
connectivity/sync-adapters/running-sync-adapter.html
connectivity/volley/index.html
connectivity/volley/request-custom.html
connectivity/volley/request-queue.html
connectivity/volley/request.html
connectivity/volley/simple.html
contacts-provider/display-badge.html
contacts-provider/index.html
contacts-provider/modify-data.html
contacts-provider/retrieve-detail.html
contacts-provider/retrieve-names.html
content-sharing/beam-files/index.html
content-sharing/beam-files/receive-files.html
content-sharing/beam-files/sending-files.html
content-sharing/secure-file-sharing/index.html
content-sharing/secure-file-sharing/request-file.html
content-sharing/secure-file-sharing/retrieve-info.html
content-sharing/secure-file-sharing/setup-sharing.html
content-sharing/secure-file-sharing/sharing-file.html
content-sharing/sharing/index.html
content-sharing/sharing/receive.html
content-sharing/sharing/send.html
content-sharing/sharing/shareaction.html
graphics/displaying-bitmaps/cache-bitmap.html
graphics/displaying-bitmaps/display-bitmap.html
graphics/displaying-bitmaps/index.html
graphics/displaying-bitmaps/load-bitmap.html
graphics/displaying-bitmaps/manage-bitmap-memory.html
graphics/displaying-bitmaps/process-bitmap.html
graphics/opengl/motion.html
graphics/opengl/draw.html
graphics/opengl/environment.html
graphics/opengl/index.html
graphics/opengl/projection.html
graphics/opengl/shapes.html
graphics/opengl/touch.html
input/game-controller/compatibility.html
input/game-controller/controller-inputs.html
input/game-controller/index.html
input/game-controller/multi-controller.html
input/gestures/detector.html
input/gestures/index.html
input/gestures/movement.html
input/gestures/multi.html
input/gestures/scale.html
input/gestures/scroll.html
input/gestures/viewgroup.html
input/keyboard-input/commands.html
input/keyboard-input/index.html
input/keyboard-input/navigation.html
input/keyboard-input/type.html
input/keyboard-input/visibility.html
location/activity-recognition.html
location/display-address.html
location/index.html
location/geofencing.html
location/location-testing.html
location/retrieve-current.html
location/retrieve-location-updates.html
multimedia/audio/audio-focus.html
multimedia/audio/audio-output.html
multimedia/audio/index.html
multimedia/audio/volume-playback.html
multimedia/camera/index.html
multimedia/camera/cameradirect.html
multimedia/camera/photobasic.html
multimedia/camera/videobasic.html
multimedia/printing/custom-docs.html
multimedia/printing/html-docs.html
multimedia/printing/index.html
multimedia/printing/photos.html
performance/improving-layouts/index.html
performance/improving-layouts/loading-ondemand.html
performance/improving-layouts/optimizing-layout.html
performance/improving-layouts/reuse-layouts.html
performance/improving-layouts/smooth-scrolling.html
performance/memory.html
performance/monitor-device-state/battery-monitor.html
performance/monitor-device-state/connectivity-monitor.html
performance/monitor-device-state/docking-monitor.html
performance/monitor-device-state/index.html
performance/monitor-device-state/manifest-receivers.html
performance/multi-threads/communicate-ui.html
performance/multi-threads/create-threadpool.html
performance/multi-threads/define-runnable.html
performance/multi-threads/index.html
performance/multi-threads/run-code.html
performance/perf-anr/index.html
performance/perf-jni/index.html
performance/performance-tips.html
performance/smp/index.html
security/enterprise/device-management-policy.html
security/enterprise/index.html
security/security-ssl.html
security/security-tips.html
testing/activity-testing/activity-basic-testing.html
testing/activity-testing/activity-function-testing.html
testing/activity-testing/activity-unit-testing.html
testing/activity-testing/activity-ui-testing.html
testing/activity-testing/index.html
testing/activity-testing/prepare-activity-testing.html
ui/accessibility/accessible-app.html
ui/accessibility/index.html
ui/accessibility/accessible-service.html
ui/backward-compatible-ui/abstract.html
ui/backward-compatible-ui/index.html
ui/backward-compatible-ui/new-impl.html
ui/backward-compatible-ui/older-impl.html
ui/backward-compatible-ui/using-component.html
ui/custom-view/create-view.html
ui/custom-view/custom-draw.html
ui/custom-view/index.html
ui/custom-view/make-interactive.html
ui/custom-view/optimize-view.html
ui/multiscreen/adapt-ui.html
ui/multiscreen/index.html
ui/multiscreen/screen-desities.html
ui/multiscreen/screen-sizes.html
ui/system-ui/index.html
ui/system-ui/dim.html
ui/system-ui/hide-ui.html
ui/system-ui/immersive.html
ui/system-ui/hide-nav.html
ui/system-ui/visibility.html
ui/tv/index.html
ui/tv/optimize-layouts-tv.html
ui/tv/optimize-nav-tv.html
ui/tv/unsupport-features-tv.html
ux/app-indexing/deep-linking.html
ux/app-indexing/enable-app-indexing.html
ux/app-indexing/index.html
ux/design-nav/ancestral-temporal.html
ux/design-nav/descendant-lateral.html
ux/design-nav/index.html
ux/design-nav/multi-sizes.html
ux/design-nav/screen-planning.html
ux/design-nav/wireframing.html
ux/implement-nav/ancestral.html
ux/implement-nav/descendant.html
ux/implement-nav/index.html
ux/implement-nav/lateral.html
ux/implement-nav/nav-drawer.html
ux/implement-nav/temporal.html
ux/notify-user/build-notification.html
ux/notify-user/expand-notification.html
ux/notify-user/index.html
ux/notify-user/nav.html
ux/notify-user/progess-notification.html
ux/notify-user/update-notification.html
ux/search/back-compat.html
ux/search/index.html
ux/search/search.html
ux/search/setup.html
wearables/apps/bt-debugging.html
wearables/apps/creating.html
wearables/apps/index.html
wearables/apps/layouts.html
wearables/apps/packaging.html
wearables/apps/voice.html
wearables/data-layer/accessing.html
wearables/data-layer/assets.html
wearables/data-layer/data-items.html
wearables/data-layer/events.html
wearables/data-layer/index.html
wearables/data-layer/messages.html
wearables/notifications/creating.html
wearables/notifications/index.html
wearables/notifications/pages.html
wearables/notifications/stacks.html
wearables/notifications/voice-input.html
gitbook/app.js
gitbook/fonts/fontawesome/FontAwesome.otf
gitbook/fonts/fontawesome/fontawesome-webfont.eot
Expand Down
30 changes: 15 additions & 15 deletions material/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Material Design中的触摸反馈,是在用户与UI元素交互时,提供视
大多数情况下,你需要在你的 XML 文件中设定视图的背景来实现这个功能:

* `?android:attr/selectableItemBackground` 用于有界Ripple动画
* `?android:attr/selectableItemBackgroundBorderless` 用于越出视图边界的动画
* `?android:attr/selectableItemBackgroundBorderless` 用于越出视图边界的动画。它会被绘制在最近的切不是全屏的父视图上。

> 注意:`selectableItemBackgroundBorderless` 是 API level 21 新加入的属性
另外,你可以使用`ripple`元素在XML资源文件中定义一个 `RippleDrawable`

你可以给`RippleDrawable`赋予一个颜色。要改变默认的触摸反馈颜色,使用主题的`android:colorControlHighlight` 属性。

更多星系,参见`RippleDrawable`类的API文档。
更多信息,参见`RippleDrawable`类的API文档。

## 使用填充效果(Reveal Effect)

Expand All @@ -51,7 +51,7 @@ Animator anim =
anim.start();
```

要用此效果隐藏一个原本可见的视图
要用此效果隐藏一个原本可见的视图

```java
// previously visible view
Expand Down Expand Up @@ -85,20 +85,19 @@ anim.start();

![Figure 1 - A transition with shared elements.](ContactsAnim.gif)


Material Design中的Activity切换,当不同Activity之间拥有共有元素,则可以通过不同状态之间的动画和形变提供视觉上的连续性。你可以为共有元素设定进入和退出Activity时的自定义动画。

* 入场变换决定视图如何入场。比如,在*爆炸式入场*变换中,视图从场外飞到屏幕中央。
* 出场变换决定视图如何退出。比如,在*爆炸式出场*变换中,视图从屏幕中央飞出场外。
* 共有元素的变换决定一个共有视图在两个Activity之间如何变换。比如,如果两个activity有同一张图片,但是放在不同位置,以及拥有不同大小,*变更图片* 变换会流畅的把图片移到相应位置,同时缩放图片大小。
* **入场变换**决定视图如何入场。比如,在*爆炸式入场*变换中,视图从场外飞到屏幕中央。
* **出场变换**决定视图如何退出。比如,在*爆炸式出场*变换中,视图从屏幕中央飞出场外。
* **共有元素的变换**决定一个共有视图在两个Activity之间如何变换。比如,如果两个activity有同一张图片,但是放在不同位置,以及拥有不同大小,*变更图片* 变换会流畅的把图片移到相应位置,同时缩放图片大小。

Android 5.0 (API level 21) 支持这些入场和退出变换:

* 爆炸 - 把视图移入或移出场景的中间
* 滑动 - 把视图从场景边缘移入或移出
* 淡入淡出 - 通过改变透明度添加或移除元素

任何继承于 Visibility 类的变换,都支持被用于入场或退出变换。更多信息,请参见 `Transition` 类的API文档。
任何继承于 [`Visibility`](http://developer.android.com/reference/android/transition/Visibility.html) 类的变换,都支持被用于入场或退出变换。更多信息,请参见 [`Transition`](http://developer.android.com/reference/android/transition/Transition.html) 类的API文档。

Android 5.0 (API level 21) 还支持这些共有元素变换效果:

Expand All @@ -111,7 +110,7 @@ Android 5.0 (API level 21) 还支持这些共有元素变换效果:

![](SceneTransition.png)

## 自定义变换
### 自定义变换

首先,当你继承Material主题的style时,要通过`android:windowContentTransitions`属性来开启窗口内容变换功能。你也可以在style定义中声明进入、退出和共有元素变换:

Expand Down Expand Up @@ -167,7 +166,7 @@ getWindow().setExitTransition(new Explode());

要尽早开始入场变换,可以在被调用的Activity上使用`Window.setAllowEnterTransitionOverlap()` 。它可以使你拥有更戏剧性的入场变换。

## 使用变换开始一个Activity
### 使用变换开始一个Activity

如果你开启Activity入场和退出效果,那么当你在用如下方法开始Activity时,变换效果会被应用:

Expand All @@ -178,7 +177,7 @@ startActivity(intent,

如果你为第二个Activity设定了入场变换,变换也会在activity开始时被启用。要在开始另一个acitivity时禁用变换,可以给bundle的选项提供一个`null`对象:

## 开始一个拥有共用元素的Activity
### 开始一个拥有共用元素的Activity

要在两个拥有共用元素的activity间进行变换动画:

Expand Down Expand Up @@ -212,7 +211,9 @@ imgContainerView.setOnClickListener(new View.OnClickListener() {

对于用代码编写的共有动态视图,使用`View.setTransitionName()`方法来在两个activity中定义共有元素。

## 开始一个拥有多个共有元素的Activity
要在第二个activity结束时进行逆向的场景变换动画,调用`Activity.finishAfterTransition()`方法,而不是`Activity.finish()`

### 开始一个拥有多个共有元素的Activity

要在拥有多个共有元素的activity之间使用变换动画,就要用`android:transitionName`属性在两个layout中定义这个共有元素(或在两个Activity中使用`View.setTransitionName()`方法),再创建`ActivityOptions`对象:

Expand Down Expand Up @@ -314,7 +315,6 @@ mAnimator.start();
</animated-selector>
```


## 动画矢量 Drawables

矢量Drawable是可以无损缩放的。`AnimatedVectorDrawable`类是你可以操作矢量Drawable。
Expand Down Expand Up @@ -364,7 +364,7 @@ mAnimator.start();
</animated-vector>
```

动画的定义代表ObjectAnimator或者AnimatorSet对象。例子中第一个animator将目标组旋转了360度。
动画的定义代表`ObjectAnimator`或者`AnimatorSet`对象。例子中第一个animator将目标组旋转了360度。

```xml
<!-- res/anim/rotation.xml -->
Expand All @@ -389,4 +389,4 @@ mAnimator.start();
</set>
```

更多信息,请参考AnimatedVectorDrawable的API指南
更多信息,请参考`AnimatedVectorDrawable`的API指南
Loading

0 comments on commit bf098e6

Please sign in to comment.