重叠头像动画 Android,一个在在CollapsingToolbarLayout上实现Android精彩的头像动画

AmazingAvatar

68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6865617273696c656e742f416d617a696e674176617461722e7376673f6d61784167653d3235393230303068747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6865617273696c656e742f416d617a696e674176617461722e7376673f6d61784167653d32353932303030

An android amazing avatar anim in CollapsingToolbarLayout.

Screenshot

screenrecord.gif

Expanded

69b279dc21216f647a3f64017e3f4fc7.png

Collapsed

4e733a956ec35b4d75e19bb111ab5a8c.png

Usage

For a working implementation, please have a look at the Sample Project - sample

9d20dd8a9e09eadb61b91ad8570b632f.png

Just Clone and Build.

Customization

You can change header view to what you want.

android:layout_width="match_parent"

android:layout_height="224dp"

app:contentScrim="@android:color/transparent"

app:layout_scrollFlags="scroll|exitUntilCollapsed"

app:statusBarScrim="@android:color/transparent"

app:titleEnabled="false">

android:id="@+id/toolbar"

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

app:layout_collapseMode="pin"

app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

android:gravity="center_vertical"

app:layout_collapseMode="parallax"

app:layout_collapseParallaxMultiplier="1">

android:id="@+id/space"

android:layout_width="32dp"

android:layout_height="32dp"

android:layout_marginLeft="32dp"/>

android:id="@+id/toolbar_title"

style="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

android:gravity="center_vertical"/>

android:layout_width="match_parent"

android:layout_height="match_parent"

app:layout_collapseMode="parallax"

app:layout_collapseParallaxMultiplier="1">

android:id="@+id/imageView_avatar"

android:layout_width="80dp"

android:layout_height="80dp"

android:layout_gravity="center_horizontal"

android:layout_marginTop="?attr/actionBarSize"

android:background="@drawable/avatar_background"

android:contentDescription="@null"

android:padding="1dp"/>

android:id="@+id/textView_title"

android:layout_width="wrap_content"

android:layout_height="?attr/actionBarSize"

android:layout_gravity="center_horizontal"

android:layout_marginTop="130dp"

android:gravity="center"

android:maxLines="1"

android:text="HearSilent"

android:textColor="#FFF"

android:textSize="24sp"/>

Compatibility

Android GINGERBREAD 4.2+

Credits

Let me know!

I'd be really happy if you sent me links to your projects where you use my component. Just send an email to hear.silent1995@gmail.com And do let me know if you have any questions or suggestion regarding the example.

License

MIT License

Copyright (c) 2017 HearSilent

Permission is hereby granted, free of charge, to any person obtaining a copy

of this software and associated documentation files (the "Software"), to deal

in the Software without restriction, including without limitation the rights

to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

copies of the Software, and to permit persons to whom the Software is

furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all

copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

SOFTWARE.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值