I'm having some trouble with my CoordinatorLayout. When I scroll up I want the imageview to disappear completely.
This is an example of view and after i scroll up http://imgur.com/KI8kouG
planet_main.xml
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/ctlLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:titleEnabled="false"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="64dp"
android:layout_marginRight="64dp"
android:layout_marginTop="32dp"
android:fitsSystemWindows="true"
android:orientation="vertical"
app:layout_collapseMode="parallax"
>
<ImageView
android:id="@+id/userAvatar"
android:layout_width="@dimen/fab_large"
android:layout_height="@dimen/fab_large"
android:layout_gravity="center_horizontal"
android:src="@drawable/pl_alderaan"
android:padding="2dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:id="@+id/userLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center_horizontal"
android:maxLines="1"
android:textSize="36sp"
android:text="Header"
android:textColor="@color/white"/>
<TextView
android:id="@+id/userName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center_horizontal"
android:maxLines="1"
android:textSize="16sp"
android:textStyle="bold"
android:text="Subheader"
android:textColor="@color/white"
/>
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@id/toolbar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/card"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_gravity="fill_vertical">
<TextView
android:id="@+id/txtDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textColor="@color/text"
android:gravity="center"
android:text="@string/lorum"
android:textSize="14sp"
android:layout_margin="10dp" />
</android.support.v4.widget.NestedScrollView>
I've also attempted to implement a custom behavior after finding a few examples on, especially this GitHub app example byGitskarios since our layouts are similar but it does not fix my issue. I also read Here that it may not be getting called due to it not being a direct child. How do I keep my layout and fade/hide the imageview?