Pull down zoom view inside the android collapsing layout - android

Collapsing layout image will only collapse and expand. Pull-down zoom view is not supported in the nested scroll view. If we zoom in on the image it does not actually zoom. What is the solution to zooming the image during pull down?
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/editprofilelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
>
​
<android.support.design.widget.AppBarLayout
android:id="#+id/materialup_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:fitsSystemWindows="true"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/main.collapsing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="#android:color/transparent"
android:fitsSystemWindows="true"
app:expandedTitleTextAppearance="#android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
>
​
<ImageView
android:id="#+id/materialup.profile_backdrop"
android:layout_width="match_parent"
android:layout_height="150dp"
android:scaleType="centerCrop"
android:src="#color/app_color"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
/>0
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_image"
android:layout_width="76dp"
android:layout_height="76dp"
android:layout_marginTop="100dp"
android:layout_marginLeft="20dp"
android:layout_gravity="left"
android:src="#drawable/profileicon"
android:background="#null"
app:border_width="0dp"
app:border_color="#FFF"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
/>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#null"
app:layout_collapseMode="pin"
android:fitsSystemWindows="true"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
android:foreground="?android:windowActionBarOverlay"
style="#style/ToolBarWithNavigationBack">
<TextView
style="#style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:visibility="gone"
android:layout_height="wrap_content"
android:textColor="#color/white" />
</android.support.v7.widget.Toolbar>
<ImageButton
android:id="#+id/editbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_edit_profile"
android:layout_marginTop="15dp"
android:layout_marginRight="20dp"
android:background="#null"
android:fitsSystemWindows="true"
android:nestedScrollingEnabled="false"
android:layout_gravity="center_horizontal|end"/>
<ImageButton
android:id="#+id/morebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_more_white"
android:visibility="invisible"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:background="#null"
android:fitsSystemWindows="true"
android:nestedScrollingEnabled="false"
android:layout_gravity="center_horizontal|end"/>
<LinearLayout
android:id="#+id/materialup.title_containermain2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="155dp"
android:clipChildren="false"
android:clipToPadding="false"
android:background="#null"
android:orientation="vertical"
android:gravity="center"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
>
<LinearLayout
android:id="#+id/materialup.title_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:orientation="vertical"
android:gravity="center"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:id="#+id/layout3"
android:clipChildren="false"
android:clipToPadding="false"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
android:background="#null"
>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="#+id/imageButton6"
android:layout_toLeftOf="#+id/editprofile"
android:layout_marginRight="15dp"
android:src="#drawable/ic_settings_profile"/>
<Button
android:layout_width="100dp"
android:layout_height="25dp"
android:id="#+id/editprofile"
android:text="Edit Profile"
android:textColor="#ffffff"
android:background="#drawable/rounded_corner_profile"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_alignTop="#+id/imageButton6"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="11dp"
android:layout_marginEnd="18dp" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="#null"
android:background="#drawable/customcheckbox"
android:visibility="invisible"
android:gravity="center_horizontal"
android:id="#+id/follow"
android:layout_alignBottom="#+id/username"
android:layout_alignRight="#+id/editprofile"
android:layout_alignEnd="#+id/editprofile" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="18dp"
android:textStyle="bold"
android:id="#+id/username"
android:textColor="#000000"
android:layout_marginTop="30dp"
android:layout_marginLeft="18dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="12dp"
android:layout_below="#+id/username"
android:id="#+id/bio"
android:textColor="#000000"
android:layout_marginTop="10dp"
android:layout_marginLeft="18dp"
/>
<ImageView
android:layout_width="15dp"
android:layout_height="wrap_content"
android:id="#+id/image4"
android:layout_below="#+id/bio"
android:src="#drawable/ic_link"
android:layout_alignBottom="#+id/website"
android:layout_marginLeft="18dp"
android:layout_marginTop="15dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="12dp"
android:textColor="#color/app_color"
android:id="#+id/website"
android:layout_below="#+id/bio"
android:layout_toRightOf="#+id/image4"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="FOLLOWERS"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="12dp"
android:id="#+id/followers"
android:layout_below="#+id/image4"
android:layout_toRightOf="#+id/followercount"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="12dp"
android:textColor="#color/app_color"
android:id="#+id/followercount"
android:layout_below="#+id/image4"
android:layout_marginLeft="18dp"
android:layout_marginTop="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/app_color"
android:text="0"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="12dp"
android:id="#+id/followingcount"
android:layout_below="#+id/image4"
android:layout_toRightOf="#+id/followers"
android:layout_marginLeft="18dp"
android:layout_marginTop="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="FOLLOWING"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="12dp"
android:id="#+id/following"
android:layout_below="#+id/image4"
android:layout_toRightOf="#+id/followingcount"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.TabLayout
android:id="#+id/tabs1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#color/white"
app:tabSelectedTextColor="#color/app_color"
app:tabTextColor="#color/app_color"
app:tabIndicatorHeight="2dp"
app:tabIndicatorColor="#color/app_color"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll"
app:tabMode="fixed"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:id="#+id/nest_scrollview"
android:fillViewport="true"
android:layout_gravity="fill_vertical"
>
</android.support.v4.widget.NestedScrollView>
<com.cogzidel.hotfuse.NonSwipeableViewPager
android:id="#+id/materialup_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
/>
</android.support.design.widget.CoordinatorLayout>

Related

I do not want collapsing toolbar to scroll at all inside coordinator layout

I have a code here which contains of a coordinator layout. Inside that coordinator layout, there is an appbar layout and a nested scrollview beneath it.I want the appbar layout(map) to be still even when nestedscroll view scrolls.I have images to explain my thoughts. Initial stage, stage two. Notice that the map remains still while only nested scroll view scrolls and finally, nested scroll view overlaps entire map fragment.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#android:color/white">
<android.support.design.widget.AppBarLayout
android:id="#+id/MyAppbar"
android:layout_width="match_parent"
android:layout_height="550dp"
android:fitsSystemWindows="true"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapse_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true">
<android.support.v7.widget.Toolbar
android:id="#+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
app:layout_collapseMode="pin"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/close_button"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:src="#drawable/close_black"
/>
<TextView
android:id="#+id/shipping_to_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SHIPPING TO"
android:textColor="#color/black"
android:textStyle="bold"
android:textSize="10dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"/>
<TextView
android:id="#+id/shipping_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="926 Rosenbaum Mill"
android:textColor="#color/black"
android:layout_below="#id/shipping_to_title"
android:textSize="16dp"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="550dp"
tools:context=".MapFragment"
android:layout_below="#id/my_toolbar"
app:layout_collapseMode="pin"
>
<RelativeLayout
android:id="#+id/outermost_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="#+id/bottom_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_centerHorizontal="true"
>
<include
android:id="#+id/getDirections"
layout="#layout/track_shipment_activity_get_directions_fragment_layout"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
/>
<include
android:id="#+id/received"
layout="#layout/track_shipment_activity_received_fragment_layout"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
/>
<include
android:id="#+id/enrouteToDestination"
layout="#layout/track_shipment_activity_button_fragment_layout"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
/>
<include
android:id="#+id/trackOrder"
layout="#layout/track_shipment_track_order_button_fragment_layout"
android:visibility="gone"
/>
<RelativeLayout
android:id="#+id/trackOrderBelow"
android:layout_width="300dp"
android:layout_height="40dp"
android:layout_below="#id/trackOrder"
android:layout_marginBottom="20dp"
android:background="#FBFBFB"
android:layout_centerHorizontal="true"
android:visibility="gone">
<TextView
android:id="#+id/tracking_code_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/tracking_code"
android:textSize="14dp"
android:textColor="#color/black"
android:layout_marginStart="10dp"
android:layout_centerVertical="true"/>
<TextView
android:id="#+id/tracking_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/tracking_code_numbers"
android:layout_toRightOf="#id/tracking_code_title"
android:textSize="14dp"
android:textColor="#color/black"
android:layout_marginStart="10dp"
android:layout_centerVertical="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/double_boxes"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_centerVertical="true"/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</fragment>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/abc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/MyAppbar"
android:layout_marginTop="30dp"
tools:context=".MapFragment">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/relative_layout_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/activity_background">
<RelativeLayout
android:id="#+id/relative_layout_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:focusedByDefault="true">
<ImageView
android:id="#+id/order_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="15dp"
android:layout_marginTop="25dp"
android:contentDescription="#string/app_name"
android:src="#drawable/orders" />
<TextView
android:id="#+id/order_date_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="#id/order_icon"
android:gravity="center"
android:paddingLeft="5dp"
android:text="#string/order_date2"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/order_date"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="15dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="#id/order_date_title"
android:gravity="center|end"
android:paddingLeft="90dp"
android:text="#string/date5"
android:textColor="#android:color/black"
android:textStyle="bold" />
<ImageView
android:id="#+id/placeBy_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#id/order_icon"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:contentDescription="#string/app_name"
android:src="#drawable/person" />
<TextView
android:id="#+id/placed_by_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/order_date_title"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/placeBy_icon"
android:gravity="center"
android:paddingLeft="5dp"
android:text="#string/placed_by"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/placed_by"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_below="#id/order_date_title"
android:layout_marginEnd="15dp"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/placed_by_title"
android:gravity="center|end"
android:paddingLeft="100dp"
android:text="#string/user_name"
android:textColor="#android:color/black"
android:textStyle="bold" />
<ImageView
android:id="#+id/delivery_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#id/placeBy_icon"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:contentDescription="#string/app_name"
android:src="#drawable/delivery" />
<TextView
android:id="#+id/delivery_method_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/placed_by_title"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/delivery_icon"
android:gravity="center"
android:paddingLeft="5dp"
android:text="#string/delivery_method"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/delivery_method"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_below="#id/placed_by_title"
android:layout_marginEnd="15dp"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/delivery_method_title"
android:gravity="center|end"
android:text="#string/shipping"
android:textColor="#android:color/black"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/add_to_calander_button_shipment"
android:layout_width="340dp"
android:layout_height="40dp"
android:layout_below="#+id/delivery_icon"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:background="#drawable/add_to_calander">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true">
<ImageView
android:id="#+id/addToCalIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/app_name"
android:src="#drawable/orders" />
<TextView
android:id="#+id/addToCalText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="2dp"
android:layout_toEndOf="#id/addToCalIcon"
android:text="#string/add_to_calander"
android:textSize="14dp" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<View
android:id="#+id/threeItems"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="#+id/relative_layout_inner"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:background="#color/activity_background" />
<TextView
android:id="#+id/threeItemstext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relative_layout_inner"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:text="#string/number_of_items"
android:textColor="#color/black"
android:textSize="16dp"
android:textStyle="bold" />
<android.support.v4.widget.NestedScrollView
android:id="#+id/nestedRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/threeItems">
<android.support.v7.widget.RecyclerView
android:id="#+id/simpleRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:nestedScrollingEnabled="false"
app:layout_behavior="#string/app_bar_scrolling_view_behavior">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.NestedScrollView>
<include
android:id="#+id/delivery_details"
layout="#layout/track_shipment_delivery_details_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/nestedRecyclerView"
android:layout_marginBottom="5dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp" />
<include
android:id="#+id/order"
layout="#layout/track_shipment_order_total_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/delivery_details"
android:layout_marginBottom="5dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp" />
<include
android:id="#+id/need_help"
layout="#layout/track_shipment_need_help_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/order"
android:layout_marginBottom="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Try adding
app:behavior_overlapTop="0dp" in your nested scroll view and also add some elevation to the nested scroll view.

NestedScrollView doesnt show cards with wrap content and dynamic data

I have an activity with view pager and I'm loading fragments which has NestedScrollView as parent with cards in it. The data in the card is loaded dynamically and doesn't have fixed height. The card's height is set to wrap_content.
The problem is that the NestedScrollView is not displaying the cards properly after the data is loaded. In some cases the cards overlap each other, while in some, the cards are not visible at all (usually the last).
The activity:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_generic_candidate_profile"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.interviewair.interviewairforemployer.ui.genericCandidateProfile.GenericCandidateProfileActivity">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbarlayout_all"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsingtoolbar_genericcandidateprofile"
android:layout_width="match_parent"
android:layout_height="300dp"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleTextAppearance="#android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="150dp">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.5"
android:background="#color/black" />
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/ic_play_circle_outline_black_24px"
android:tint="#color/white"
android:elevation="10dp"
android:alpha="0.7"
android:layout_gravity="center"/>
</FrameLayout>
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/circleimageview_genericcandidateprofile_photo"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="#dimen/margin_10"
android:src="#drawable/ic_person_outline_white_48px"
app:civ_border_color="#color/white"
app:civ_border_width="1.5dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="30dp"
android:layout_marginStart="#dimen/margin_10"
android:orientation="vertical">
<TextView
android:id="#+id/textview_genericcandidateprofile_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin_5"
android:drawablePadding="#dimen/padding_5"
android:gravity="center_vertical"
android:textColor="#color/white"
android:textSize="#dimen/di_text_medium"
android:textStyle="bold" />
<TextView
android:id="#+id/textview_genericcandidateprofile_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin_5"
android:alpha="0.8"
android:drawableLeft="#drawable/ic_work_black_18dp"
android:drawablePadding="#dimen/padding_5"
android:gravity="center_vertical"
android:textColor="#color/white"
android:textSize="#dimen/di_text_regular" />
<TextView
android:id="#+id/textview_genericcandidateprofile_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin_5"
android:alpha="0.8"
android:drawableLeft="#drawable/ic_location_on_black_18px"
android:drawablePadding="#dimen/padding_5"
android:gravity="center_vertical"
android:text="Mumbai, Maharashtra"
android:textColor="#color/white"
android:textSize="#dimen/di_text_regular" />
</LinearLayout>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_genericcandidateprofile"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.TabLayout
android:id="#+id/tablayout_genericcandidateprofile_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin"
app:tabGravity="fill"
app:tabIndicatorColor="#color/white"
app:tabIndicatorHeight="5dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="#color/white"
app:tabTextColor="#color/grey500" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager_genericcandidateprofile_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="#dimen/fab_margin"
android:layout_marginBottom="#dimen/fab_margin"
app:borderWidth="0dp"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
android:clickable="true"
app:rippleColor="#color/colorPrimary"
android:src="#drawable/ic_dashboard_white_24px"/>
</android.support.design.widget.CoordinatorLayout>
The fragment that is being loaded:
<android.support.v7.widget.CardView
android:id="#+id/cardview_overview_skills"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/margin_5">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="#dimen/padding_10">
<TextView
android:id="#+id/textview_overview_skilltitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="#dimen/padding_5"
android:gravity="center_vertical"
android:text="#string/text_skills"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/di_text_regular" />
<com.dpizarro.autolabel.library.AutoLabelUI
android:id="#+id/autolabel_overview_skillchips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textview_overview_skilltitle"
android:layout_marginTop="#dimen/margin_10"
autolabel:label_background_res="#drawable/custom_rounded_background"
autolabel:label_clickable="false"
autolabel:show_cross="false"
autolabel:text_color="#android:color/black"
autolabel:text_size="#dimen/di_text_small" />
<ImageView
android:id="#+id/imageview_overview_retry_skills"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:background="#drawable/custom_button_grey_background"
android:src="#drawable/ic_refresh_black_24px"
android:tint="#color/colorAccent"
android:visibility="gone" />
<ProgressBar
android:id="#+id/progressbar_overview_skillpb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"
android:visibility="gone" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/cardview_overview_preferredlocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/cardview_overview_skills"
android:layout_margin="#dimen/margin_5">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="#dimen/padding_10">
<TextView
android:id="#+id/textview_overview_loctitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/text_preferred_location"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/di_text_regular" />
<com.dpizarro.autolabel.library.AutoLabelUI
android:id="#+id/autolabel_overview_preflocchips"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textview_overview_loctitle"
android:layout_marginTop="#dimen/margin_10"
autolabel:label_background_res="#drawable/custom_rounded_background"
autolabel:label_clickable="false"
autolabel:show_cross="false"
autolabel:text_color="#android:color/black"
autolabel:text_size="#dimen/di_text_small" />
<ImageView
android:id="#+id/imageview_overview_retry_loc"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:background="#drawable/custom_button_grey_background"
android:src="#drawable/ic_refresh_black_24px"
android:tint="#color/colorAccent"
android:visibility="gone" />
<ProgressBar
android:id="#+id/progressbar_overview_locpb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"
android:visibility="gone" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/cardview_overview_personal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/cardview_overview_eduexp"
android:layout_margin="#dimen/margin_5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="#dimen/padding_5">
<TextView
android:id="#+id/textview_overview_personaltitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="#dimen/padding_5"
android:gravity="center_vertical"
android:text="#string/text_personal"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/di_text_regular" />
<LinearLayout
android:id="#+id/linearlayout_overview_personalwrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/margin_5"
android:layout_marginTop="#dimen/margin_10"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="#string/text_email"
android:textColor="#color/grey700"
android:textSize="#dimen/di_text_regular" />
<TextView
android:id="#+id/textview_overview_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="#dimen/di_text_regular" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_5"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="#string/text_mobile"
android:textColor="#color/grey700"
android:textSize="#dimen/di_text_regular" />
<TextView
android:id="#+id/textview_overview_mobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="#dimen/di_text_regular" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_5"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="#string/text_dob"
android:textColor="#color/grey700"
android:textSize="#dimen/di_text_regular" />
<TextView
android:id="#+id/textview_overview_dob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="#dimen/di_text_regular" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_5"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="#string/text_gender"
android:textColor="#color/grey700"
android:textSize="#dimen/di_text_regular" />
<TextView
android:id="#+id/textview_overview_gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="#dimen/di_text_regular" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/imageview_overview_retry_personal"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:background="#drawable/custom_button_grey_background"
android:src="#drawable/ic_refresh_black_24px"
android:tint="#color/colorAccent"
android:visibility="gone" />
<ProgressBar
android:id="#+id/progressbar_overview_personalpb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminate="true"
android:visibility="gone" />
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>

CollapsingToolbarLayout also collapse Toolbar when using with RecyclerView when scrolling up

CollapsingToolbarLayout also collapse Toolbar when using with RecyclerView when scrolling up
I don't want to make Toolbar(ActionBar) disappear when scrolling screen up or while collapsing within AppBarLayout.
I am using CoordinatorLayout.
Following is my layout file
<?xml version="1.0" encoding="utf-8"?>
<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:id="#+id/coordinator"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="#dimen/header_pic_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|enterAlways"
android:fitsSystemWindows="true"
app:contentScrim="#color/PrimaryColor"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
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/AppTheme"
android:title=" "
app:layout_collapseMode="pin" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_collapseMode="parallax"
android:background="#color/PrimaryColor"
android:padding="5dp">
<FrameLayout
android:layout_width="55dp"
android:layout_marginLeft="8dp"
android:layout_height="match_parent"
android:layout_marginRight="16dp">
<ImageView
android:id="#+id/imageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="5dp"
/>
<ImageView
android:id="#+id/check_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="20dp"
android:src="#drawable/check_sm"
android:layout_gravity="center_vertical"
android:visibility="gone" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_collapseMode="parallax" >
<TextView
android:id="#+id/projectName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/MainFragmentTicketItemAccount"
android:ellipsize="end"
android:singleLine="true"
android:text="Project Name"
android:layout_marginLeft="6dp"
android:textColor="#android:color/white"
android:textSize="#dimen/list_text_size"/>
<TextView
android:id="#+id/labelProjectNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:gravity="right"
android:singleLine="true"
android:text="#string/lbl_project_no"
android:textSize="14sp"
android:textColor="#color/label_color" />
<TextView
android:id="#+id/projectNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:maxLines="2"
android:layout_marginLeft="6dp"
android:text="657894512"
android:textStyle="bold"
android:textColor="#color/text_color"
android:textSize="12sp" />
<TextView
android:id="#+id/labelAccountName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:gravity="right"
android:singleLine="true"
android:text="#string/lbl_account_name"
android:textSize="14sp"
android:textColor="#color/label_color" />
<TextView
android:id="#+id/accountName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:maxLines="2"
android:layout_marginLeft="6dp"
android:text="Aqui del carlos"
android:textStyle="bold"
android:textColor="#color/text_color"
android:textSize="12sp" />
<TextView
android:id="#+id/labelstartDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:gravity="right"
android:singleLine="true"
android:text="#string/start_date"
android:textSize="14sp"
android:textColor="#color/label_color" />
<TextView
android:id="#+id/startDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:maxLines="2"
android:layout_marginLeft="6dp"
android:text="25-06-2016"
android:textStyle="bold"
android:textColor="#color/text_color"
android:textSize="12sp" />
<TextView
android:id="#+id/labelEndDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:gravity="right"
android:singleLine="true"
android:text="#string/acc5"
android:textSize="14sp"
android:textColor="#color/label_color" />
<TextView
android:id="#+id/endDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:maxLines="2"
android:layout_marginLeft="6dp"
android:text="30-06-2016"
android:textStyle="bold"
android:textColor="#color/text_color"
android:textSize="12sp" />
<TextView
android:id="#+id/labelpadidod_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:gravity="right"
android:singleLine="true"
android:text="#string/lbl_padido_no"
android:textSize="14sp"
android:textColor="#color/label_color" />
<TextView
android:id="#+id/padidoNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:maxLines="2"
android:layout_marginLeft="6dp"
android:text="4581233"
android:textStyle="bold"
android:textColor="#color/text_color"
android:textSize="12sp" />
<TextView
android:id="#+id/lbl_installation_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:gravity="right"
android:singleLine="true"
android:text="#string/lbl_installation_no"
android:textSize="14sp"
android:textColor="#color/label_color" />
<TextView
android:id="#+id/installationNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:maxLines="2"
android:layout_marginLeft="6dp"
android:text="4581233"
android:textStyle="bold"
android:textColor="#color/text_color"
android:textSize="12sp" />
<TextView
android:id="#+id/lbl_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="15dp"
android:ellipsize="end"
android:gravity="right"
android:singleLine="true"
android:text="#string/status"
android:textSize="14sp"
android:textColor="#color/label_color" />
<TextView
android:id="#+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:maxLines="2"
android:layout_marginLeft="6dp"
android:text="Activo"
android:textStyle="bold"
android:textColor="#color/text_color"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/imageView123"
android:layout_width="match_parent"
android:layout_height="30dp"
android:src="#drawable/arrow_up_circle"/>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/simpleRecyclerView"
android:layout_height="match_parent"
android:layout_width="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="#+id/MainFragmentEmptyLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone"
android:gravity="center">
<ImageView
android:layout_height="194dp"
android:layout_width="253dp"
android:src="#drawable/ic_main_no_data"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/no_data1"
android:textSize="25sp"
android:textStyle="bold"
android:textColor="#color/info_no_data_color"
android:layout_marginTop="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/no_data2"
android:textSize="15sp"
android:textStyle="normal"
android:textColor="#color/info_no_data_color"
android:layout_marginTop="5dp"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
while scrolling appBar it should be fixed when reached to toolbar height, so i need toolbar fixed at its position.
thanks.
My requirement is something different from other SO question that is toolBar not collapsing etc but in my case i don't wanted to collapse my toolBar while scrolling up and collapsing appBar,
So i came up with following solution, this will help someone with similar issue.
<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:minHeight="?attr/actionBarSize"
android:fitsSystemWindows="true"
app:contentScrim="#color/PrimaryColor"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
following couple line of code solved my issue.
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:minHeight="?attr/actionBarSize"

CollapsingToolbarLayout collapsed with nested scrollview by default

I don't understand why my CollapsingToolbar layout is collapsed when my view is created by default.
I think this the NestedScrollView the responsible but i don't no why.
This make me crazy.
My activity layout :
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar"
android:layout_width="match_parent"
android:layout_height="#dimen/app_bar_height"
android:fitsSystemWindows="true"
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"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v4.view.ViewPager
android:id="#+id/pager_images"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_product" />
</android.support.design.widget.CoordinatorLayout>
And my content_layout with nested scrollview :
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="4dp">
<include layout="#layout/layout_progress" />
<TextView
android:id="#+id/tv_reference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="2dp"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:maxLines="1"
android:text=""
android:textColor="#color/MyApp_gray"
android:textSize="10sp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:fontFamily="sans-serif-light"
android:maxLines="2"
android:text=""
android:textColor="#color/cardview_dark_background"
android:textSize="16sp" />
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view_choix"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:background="#android:color/white"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="1dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:id="#+id/tv_quantity_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:maxLines="2"
android:text="#string/product_quantity"
android:textColor="#color/cardview_dark_background"
android:textSize="12sp" />
<com.MyApp.utils.HorizontalNumberPicker
android:id="#+id/horizontal_qty_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:background="#color/MyApp_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text=""
android:textColor="#color/cardview_dark_background"
android:textSize="18sp"
android:textStyle="" />
<TextView
android:id="#+id/tv_price_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text=" / Unité"
android:textColor="#color/cardview_dark_background"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:id="#+id/tv_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="10dp"
android:drawableLeft="#drawable/ic_hourglass_red_18dp"
android:drawablePadding="4dp"
android:gravity="center"
android:maxLines="2"
android:text=""
android:textColor="#color/MyApp_gray"
android:textSize="12sp"
android:visibility="gone" />
</LinearLayout>
</android.support.v7.widget.CardView>
<Button
android:id="#+id/btn_book"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:layout_marginTop="10dp"
android:background="#drawable/btn_primary"
android:drawableLeft="#drawable/ic_add_shopping_cart_white_24dp"
android:drawablePadding="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="#string/store_action_book"
android:textColor="#android:color/white"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_desc_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="2dp"
android:layout_marginTop="20dp"
android:ellipsize="end"
android:maxLines="1"
android:text="#string/product_description"
android:textColor="#color/cardview_dark_background"
android:textSize="14sp"
android:textStyle="bold" />
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:background="#android:color/white"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="1dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<at.blogc.android.views.ExpandableTextView
android:id="#+id/tv_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:maxLines="5"
android:text=""
android:textColor="#color/MyApp_gray"
android:textIsSelectable="true"
android:textSize="12sp"
app:animation_duration="1000" />
<Button
android:id="#+id/btn_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/transparent"
android:text="#string/action_expand"
android:textColor="#color/MyApp_red" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
Rendering :
More strange it still working when i use the NestedScrollView to top. It seems like the NestedScrollView scroll to bottom automatically.
Solved with this thread :
nestedscrollview-scroll-down-itself-when-content-is-fills
android:descendantFocusability="blocksDescendants" to the LinearLayout inside NestedScrollView
Worked for me.

How to implement snapping in CollapsingToolbarLayout?

I have a collapsing toolbar layout, below that a tab layout and below that the corresponding viewpager. I want to implement snapping such that when I collapse the collapsing toolbar layout more than half and leave it, it should snap and collapse completely. How do I do it? Here is my actual layout :
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#231f20"
android:fitsSystemWindows="true">
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
android:background="#231f20"
app:layout_anchor="#+id/appbar"
app:layout_anchorGravity="bottom"
app:tabGravity="fill"
app:tabMode="fixed" />
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="#FAC80A"
app:expandedTitleMarginBottom="110dp"
app:expandedTitleMarginStart="200dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax">
<ImageView
android:id="#+id/imageView78"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:background="#drawable/user_profile_bg_img"
android:scaleType="fitXY"
android:src="#drawable/gradient" />
<ImageView
android:id="#+id/imageView82"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="10dp"
android:src="#drawable/user_profile_shape_profile_pic"
android:layout_centerVertical="true"
android:layout_marginLeft="30dp" />
<ImageView
android:id="#+id/imageView80"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:elevation="10dp"
android:layout_marginRight="60dp"
android:layout_marginTop="35dp" />
<ImageView
android:id="#+id/imageView81"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="10dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dp"
android:layout_marginTop="35dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="300dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:paddingRight="10dp"
android:elevation="10dp"
android:id="#+id/fans">
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="16sp" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.8"
android:text="Fans"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
<ImageView
android:id="#+id/imageView179"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:src="#drawable/user_profile_thin_line_separator_profile_metrics" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:paddingRight="10dp"
android:elevation="10dp"
android:id="#+id/comments">
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="16sp" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.8"
android:text="Comments"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
<ImageView
android:id="#+id/imageView180"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:src="#drawable/user_profile_thin_line_separator_profile_metrics" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:paddingRight="10dp"
android:elevation="10dp"
android:id="#+id/bookmarks">
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="16sp" />
<TextView
android:id="#+id/textView111"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.8"
android:text="Bookmarks"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
<ImageView
android:id="#+id/imageView181"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:src="#drawable/user_profile_thin_line_separator_profile_metrics" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:elevation="10dp"
android:id="#+id/galleries">
<TextView
android:id="#+id/textView112"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="16sp" />
<TextView
android:id="#+id/textView113"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.8"
android:text="Galleries"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFFFFF" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/textView114"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="200dp"
android:layout_marginTop="200dp"
android:textColor="#FFFFFF" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:elevation="4dp"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
it latest version of the design library, compile 'com.android.support:design:23.1.0', the snap has been added
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
should do it

Categories

Resources