0

Been seeing many applications using this feature starting from Google Play Store where the action bar is interact with a photo when scrolling, I don't know what it is called or how to apply it, or what elements should I use for it.

enter image description here

enter image description here

enter image description here

Convict Moody
  • 781
  • 1
  • 9
  • 28
  • This StackOverflow answer seems to cover it, I think. http://stackoverflow.com/questions/25424818/how-to-make-a-actionbar-like-google-play-that-fades-in-when-scrolling – Connor Gurney Mar 31 '16 at 23:56
  • 1
    [Collapsing Toolbar Layout in the Design Support Library](http://android-developers.blogspot.co.uk/2015/05/android-design-support-library.html) – PPartisan Mar 31 '16 at 23:57
  • Thanks a lot for the fast response, that's what i was searching about. – Convict Moody Mar 31 '16 at 23:59

1 Answers1

0

It is a CollapsingToolbarLayout.

Here is an example extracted from this link:

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleMarginEnd="64dp"
            android:fitsSystemWindows="true">

            <com.antonioleiva.materializeyourapp.SquareImageView
                android:id="@+id/image"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scaleType="centerCrop"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="parallax"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:layout_collapseMode="pin" />

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

</android.support.design.widget.CoordinatorLayout>
Evin1_
  • 12,292
  • 9
  • 45
  • 47