-2

how can i create a layout like this picture. When scrolls down texts, it hides imageview. What kind of layout should I use for this?

Start

Result

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
ARLEQUINA
  • 129
  • 1
  • 1
  • 11
  • Try with this - https://stackoverflow.com/questions/33058496/set-starting-height-of-collapsingtoolbarlayout – Adil Jan 27 '18 at 08:57

1 Answers1

-1

Hello you need to implement collapsing toolbar using support design library.

add below code into your app level gradle file

implementation 'com.android.support:design:23.0.1'

now add this code into your xml file

 <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:elevation="6dp"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlwaysCollapsed">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/placeholder"
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"
                app:layout_collapseMode="parallax"/>

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

please remember you need to use app:layout_collapseMode="parallax" in your ImageView.

Hope this will help you.

Amrish Kakadiya
  • 974
  • 1
  • 7
  • 25