How to do the new PlayStore parallax effect

前端 未结 6 532
栀梦
栀梦 2020-12-02 09:27

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

6条回答
  •  爱一瞬间的悲伤
    2020-12-02 09:39

    There's a library called FadingActionBar that does exactly what you're asking for. You can find the library on GitHub (click) and a Demo-Application in the Play Store (click).

    Usage would be something like this:

    FadingActionBarHelper helper = new FadingActionBarHelper()
        // Set the ActionBar drawable - basically the color
        .actionBarBackground(R.drawable.ab_background)
        // Set the Header - usually an image
        .headerLayout(R.layout.header)
        // Set the main layout
        .contentLayout(R.layout.activity_scrollview);
    setContentView(helper.createView(this));
    helper.initActionBar(this);
    

提交回复
热议问题