新的PlayStore视差效果怎么做 [英] How to do the new PlayStore parallax effect

查看:33
本文介绍了新的PlayStore视差效果怎么做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道我怎样才能实现新的视差滚动效果 - 在 PlayStore 上打开应用程序并尝试向下滚动时,您可以看到效果,内容超过顶部图像.我怎样才能做到这一点?

Does anyone know how can I achieve the new parallax scrolling effect - you can see the effect when you open an app on the PlayStore and try to scroll down, the content goes over the top image. How can I achieve that?

推荐答案

Google 最近宣布了 设计支持库 并由此支持实施折叠工具栏.

Google has recently announced Design support library and with this it has support for implementing Collapsing Toolbar.

除了固定视图之外,您还可以使用app:layout_collapseMode="parallax"(和可选app:layout_collapseParallaxMultiplier="0.7" 设置视差乘数)来实现视差滚动(比如兄弟姐妹CollapsingToolbarLayout)

In addition to pinning a view, you can use app:layout_collapseMode="parallax" (and optionally app:layout_collapseParallaxMultiplier="0.7" to set the parallax multiplier) to implement parallax scrolling (say of a sibling ImageView within the CollapsingToolbarLayout)

示例:

<android.support.design.widget.AppBarLayout
        android:layout_height="192dp"
        android:layout_width="match_parent">
    <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">
        <android.support.v7.widget.Toolbar
                android:layout_height="?attr/actionBarSize"
                android:layout_width="match_parent"
                app:layout_collapseMode="pin"/>
        </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

这篇关于新的PlayStore视差效果怎么做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆