项目作者: anzewei

项目描述 :
Android design的扩展,实现CollapsingToolbarLayout的下拉缩放
高级语言: Java
项目地址: git://github.com/anzewei/Android-DesignEx.git
创建时间: 2016-01-02T09:37:09Z
项目社区:https://github.com/anzewei/Android-DesignEx

开源协议:Apache License 2.0

下载


androidDesignEx

包含两个Design的扩展

  • 1 ParallaxScaleBehavior 下拉缩放CollapsingToolbarLayout中的image
  • 2 CollapsingCenterLayout 居中显示title的CollapsingToolbarLayout

Demo Apk

下载

使用

Download

Step 1

  • 添加以下代码到 build.gradle
  1. compile 'com.github.anzewei.design:androidDesignEx:0.6'

ParallaxScaleBehavior的使用

  • 为AppBarLayout 设置Behavior,CollapsingToolbarLayout的第一个child用于缩放,如果为AppBarLayout的第一个child不是CollapsingToolbarLayout,将会使用id为image的view
  1. <android.support.design.widget.AppBarLayout
  2. android:id="@+id/appbar"
  3. android:layout_width="match_parent"
  4. android:layout_height="wrap_content"
  5. app:layout_behavior="android.support.design.widget.ParallaxScaleBehavior">
  6. <android.support.design.widget.CollapsingToolbarLayout>
  7. <ImageView
  8. android:id="@id/image"></ImageView>
  9. </android.support.design.widget.CollapsingToolbarLayout>
  10. </android.support.design.widget.AppBarLayout

CollapsingCenterLayout的使用

  1. CollapsingCenterLayout继承自CollapsingToolbarLayout,用法和CollapsingToolbarLayout相同
  1. <android.support.design.widget.AppBarLayout
  2. android:id="@+id/appbar"
  3. android:layout_width="match_parent"
  4. android:layout_height="wrap_content"
  5. app:layout_behavior="android.support.design.widget.ParallaxScaleBehavior">
  6. <com.github.anzewei.design.CollapsingCenterLayout>
  7. ...
  8. </com.github.anzewei.design.CollapsingCenterLayout>
  9. </android.support.design.widget.AppBarLayout

License

Copyright 2015 anzewei

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.