A
A
Alina Mitrokhina2020-02-13 22:28:25
Android
Alina Mitrokhina, 2020-02-13 22:28:25

How to make such slider inside CollapsingToolbar?

I'm trying to do something like this . The whole point is that the images switch every 3-5 seconds. Like a slideshow. This is not a static background for CollapsingToolbar

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri, 2020-02-16
@fursa08

<android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/detail_backdrop_height"
        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"
            android:fitsSystemWindows="true"
            app:statusBarScrim="@android:color/transparent"
            app:contentScrim="@android:color/transparent">

            <ImageView
                android:id="@+id/backdrop"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                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="100dp"
                android:background="@android:color/transparent"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:layout_collapseMode="pin" />

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

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

Make the usual collapsing tollbar, well, change the picture in the imageView.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question