NestedScrollView not parallaxing smoothly with AppBarLayout - android

I have the following 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/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/treasure_background"
android:fitsSystemWindows="false">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
app:layout_behavior="trasurhunt.nicbit.com.traserhunt.schedule.FlingBehavior">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
android:elevation="0dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="66.5dp"
android:orientation="vertical"
android:paddingBottom="15dp"
android:background="#color/treasure_background"
app:layout_collapseMode="parallax">
<LinearLayout
android:id="#+id/infoRL"
android:orientation="vertical"
app:layout_collapseMode="parallax"
android:layout_width="match_parent"
android:paddingBottom="20dp"
android:layout_height="wrap_content"
android:background="#color/treasure_yellow">
<com.joooonho.SelectableRoundedImageView
android:id="#+id/hostImage"
android:layout_width="62dp"
android:layout_gravity="center_horizontal"
android:layout_height="62dp"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
app:sriv_left_bottom_corner_radius="0dp"
app:sriv_oval="true"
app:sriv_right_bottom_corner_radius="0dp"
android:src="#drawable/default_image"/>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="#+id/hostName"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/hostImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="4dp"
android:text="Speaker Name"
android:textColor="#color/treasure_black"
android:textSize="15sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="#+id/scheduleTitle"
android:layout_gravity="center_horizontal"
android:textAlignment="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/hostName"
android:layout_centerHorizontal="true"
android:layout_marginTop="29dp"
android:text="Schedule Title"
android:textColor="#color/treasure_black"
android:textSize="21sp" />
<RelativeLayout
android:id="#+id/locationRL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/scheduleTitle"
android:layout_gravity="center"
android:layout_marginTop="20.5dp"
>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="#+id/locationLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/location"
android:textColor="#color/treasure_black"
android:textSize="14sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="#+id/eventHallName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/locationLabel"
android:layout_toEndOf="#+id/locationLabel"
android:text=" Hall Of Event"
android:textColor="#color/treasure_black"
android:textSize="14sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/timeRL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/locationRL"
android:layout_gravity="center"
android:layout_marginTop="4dp"
>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="#+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/timeLabel"
android:textColor="#color/treasure_black"
android:textSize="15sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="#+id/startTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/time"
android:layout_toEndOf="#+id/time"
android:text="05:30 AM"
android:textColor="#color/treasure_black"
android:textSize="15sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="#+id/toDash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/startTime"
android:layout_toEndOf="#+id/startTime"
android:text=" - "
android:textColor="#color/treasure_black"
android:textSize="15sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="#+id/endTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/toDash"
android:layout_toEndOf="#+id/toDash"
android:text="05:30 AM"
android:textColor="#color/treasure_black"
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="trasurhunt.nicbit.com.traserhunt.schedule.FixedScrollingViewBehavior"
android:background="#color/treasure_background"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="70dp"
android:background="#color/treasure_background"
android:orientation="vertical"
android:paddingLeft="19.5dp">
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="#+id/synopsisLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/synopsis"
android:textColor="#color/treasure_cyan"
android:textSize="21sp"
android:layout_marginTop="31dp"
android:layout_marginBottom="14dp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="#+id/synopsis"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="15dp"
android:text="#string/loremIpsumPara"
android:textColor="#color/treasure_white"
android:layout_marginRight="15dp"
/>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="#+id/aboutSpeakerLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/aboutSpeakerLabel"
android:textColor="#color/treasure_cyan"
android:textSize="21sp"
android:layout_marginTop="36.5dp"
android:layout_marginBottom="14dp"
/>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="#+id/aboutSpeaker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="15dp"
android:text="#string/loremIpsumPara"
android:textColor="#color/treasure_white"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<include
layout="#layout/custom_toolbar" />
<Button
android:id="#+id/checkInButton"
android:text="#string/checkInString"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="false"
android:layout_gravity="bottom"
android:layout_centerHorizontal="true"
style="#style/Widget.AppCompat.Button.Colored"
android:backgroundTint="#color/treasure_yellow"
android:background="#e2fb02"
android:textColor="#color/treasure_dark_gray"
android:textSize="22sp"
android:paddingTop="4dp"
android:paddingBottom="4dp" />
</android.support.design.widget.CoordinatorLayout>
when I try scrolling up, it doesnt work properly and is lagging and getting stuck, whereas scrolldown seems fine. I cant figure out why.
I searched a lot and made a lot of changed but still it isnt working.
Here is what my activity looks like

check it hope it will work for you
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="end">
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<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"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75">
<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_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/backgrnd"
android:contentDescription=""
android:fitsSystemWindows="true"
android:scaleType="fitXY"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="ContentDescription" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a3441f77"
android:fitsSystemWindows="true"
android:scaleType="fitXY"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75">
<LinearLayout
android:id="#+id/listarrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
android:orientation="horizontal"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="UseCompoundDrawables,UselessParent">
<TextView
android:id="#+id/coachingname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:text="Kota"
android:textSize="20sp"
android:textStyle="bold"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="HardcodedText,RtlHardcoded" />
<ImageView
android:id="#+id/imageList"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:src="#drawable/arrow"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="ContentDescription,RtlHardcoded" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
app:popupTheme="#style/AppTheme.PopupOverlay"></android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="UselessParent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|left"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:text="Housing.com"
android:textColor="#ffffff"
android:textStyle="bold"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="HardcodedText,RtlHardcoded,RtlSymmetry" />
<ImageView
android:id="#+id/drowerimage"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center|end"
android:layout_weight=".25"
android:clickable="true"
android:src="#drawable/user"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/collapsing_logo"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
app:layout_collapseMode="pin">
<LinearLayout
android:id="#+id/search1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="#drawable/search_shape"
android:orientation="horizontal"
app:layout_collapseMode="pin"
tools:ignore="UselessParent">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:src="#drawable/ic_action_search" />
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Search"
android:textColor="#FF8C8C8C"
android:textSize="17sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<ViewStub
android:id="#+id/layout_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:inflatedId="#+id/message_layout" />
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/fab_margin"
app:srcCompat="#android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_home"
app:menu="#menu/activity_home_drawer" />
</android.support.v4.widget.DrawerLayout>
I'm using the ViewStub in the NestedScrollView so you can inflate your synopsis part in Viewstub

Related

To disable scrolling in TabLayout fragment in CollapsingToolbar

I have a screen with CollapsingToolbar and below I have a TabLayout with some fragments.
One such fragment has data retrieved with RecyclerView.
The problem is when the screen shrinks the fragment that has the RecyclerView scrolls together and delays the CollapsingToolbar, giving an unwanted effect.
Is there any way I can block the Scroll of the fragment until CollapsingToolbar finishes the process and collapses completely?
Link Gif Sample
Code 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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<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.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="#color/cinzaMEdio"
app:expandedTitleGravity="bottom"
android:background="#android:color/white"
app:expandedTitleMarginBottom="170dp"
app:expandedTitleMarginStart="10dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="225dp">
<ImageView
android:id="#+id/main.backdrop"
android:layout_width="match_parent"
android:layout_height="#dimen/nav_header_height"
android:fitsSystemWindows="true"
android:src="#drawable/hair"
app:layout_collapseMode="parallax"
android:adjustViewBounds="true"
android:cropToPadding="false"
android:scaleType="fitXY"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="225dp"
android:background="#drawable/gradient_bg">
</FrameLayout>
<TextView
android:id="#+id/tvPerEmpNome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="10dp"
android:layout_marginBottom="28dp"
android:text="Firma X"
android:textColor="#android:color/white"
android:textSize="24sp"
app:layout_collapseMode="parallax"
android:textStyle="bold"/>
<TextView
android:id="#+id/tvNomeCidade"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="10dp"
android:layout_marginStart="10dp"
android:text="São Paulo - SP"
android:textColor="#android:color/white"
android:textSize="14sp"
app:layout_collapseMode="parallax" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="120dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<LinearLayout
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:clickable="true"
android:background="#drawable/ripple_menus_perfil_empresa">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:background="#drawable/ic_person_add"
android:baselineAlignBottom="false"
android:clickable="true"
android:cropToPadding="false"
android:scaleType="centerCrop"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="5dp"
android:text="Seguir"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:clickable="true"
android:background="#drawable/ripple_menus_perfil_empresa">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:background="#drawable/ic_star_half"
android:baselineAlignBottom="false"
android:clickable="true"
android:cropToPadding="false"
android:scaleType="centerCrop" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="5dp"
android:text="Avaliações"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:clickable="true"
android:background="#drawable/ripple_menus_perfil_empresa">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:background="#drawable/ic_photo"
android:baselineAlignBottom="false"
android:clickable="true"
android:cropToPadding="false"
android:scaleType="centerCrop" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="5dp"
android:text="Fotos"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:clickable="true"
android:background="#drawable/ripple_menus_perfil_empresa">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:background="#drawable/ic_business"
android:baselineAlignBottom="false"
android:clickable="true"
android:cropToPadding="false"
android:scaleType="centerCrop" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="5dp"
android:text="Sobre"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="65dp"
android:orientation="horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Agendar"
android:textSize="16sp"
android:textAlignment="center"
android:background="#drawable/ripple_button_border_black"
android:textColor="#android:color/black"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:clickable="true"
android:paddingBottom="5dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Mensagem"
android:textAlignment="center"
android:textSize="16sp"
android:background="#drawable/ripple_button_black"
android:textColor="#android:color/white"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:clickable="true"
android:paddingBottom="5dp"/>
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbarPerfilEmpresa"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top"
android:layout_marginBottom="48dp"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways" />
<View
android:layout_width="match_parent"
android:layout_height="3dp"
android:layout_gravity="bottom|end"
android:layout_marginBottom="48dp"
android:background="#color/cinza300"
app:layout_collapseMode="parallax" />
<android.support.design.widget.TabLayout
android:id="#+id/tabs_perf_emp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#color/cinzaMEdio"
app:layout_collapseMode="pin"
app:tabTextAppearance="#style/MineCustomTabText">
</android.support.design.widget.TabLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/nestedScrollViewContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffff0d02"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="#+id/pager_tabs_perf_emp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:minHeight="600dp"
android:layout_weight="1"
android:background="#color/cinza300"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Code Fragment:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/cardFeedUser_list" />
</RelativeLayout>
You must use setNestedScrollingEnabled(false) for cardFeedUser_list recyclerView
If you are using API > 21
recyclerView.setNestedScrollingEnabled(false)
If you are using API < 21
ViewCompat.setNestedScrollingEnabled(recyclerView, true);
for the support library, you can easily control your app bar visibility.
setExpanded(true,true);
or
setExpanded(false,true);
Also, you can use DragCallback Method
private void setDragCallback() {
setDragCallback(new DragCallback() {
#Override
public boolean canDrag(#NonNull AppBarLayout appBarLayout) {
return mEnabled;
}
});
}
Solution. Removed NestedScrollView
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/pager_tabs_perf_emp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="600dp"
android:layout_weight="1"
android:background="#color/cinza300"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
/>
</android.support.design.widget.CoordinatorLayout>

Grid view scrolling is not working in android

I am developing an android application in my application I wanted to use CollapsingToolbarLayout and GridView in a same page.The CollapsingToolBar is working properly. But My GridView Scrolling is not working.
activity_health.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_offer_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="akhil.com.d4d.activities.OfferDetails">
<android.support.design.widget.AppBarLayout
android:id="#+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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="wrap_content"
app:contentScrim="?attr/colorPrimary"
android:fitsSystemWindows="true"
android:background="#E7E7E7"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<!--
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar1"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />-->
<RelativeLayout
android:id="#+id/Rlayout_H_menus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:paddingLeft="15dp"
android:layout_marginRight="15dp"
android:paddingTop="15dp"
android:id="#+id/layoutmenu1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/menu_offers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:background="#drawable/roundblue"
android:scaleType="center"
android:src="#drawable/offer" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Offers"
android:textColor="#color/black" />
</LinearLayout>
<LinearLayout
android:id="#+id/menu_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_toRightOf="#+id/menu_offers"
android:orientation="vertical">
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:background="#drawable/roundblue"
android:scaleType="center"
android:src="#drawable/menu" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Menu"
android:textColor="#color/black" />
</LinearLayout>
<LinearLayout
android:id="#+id/menu_exchange"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_toRightOf="#+id/menu_menu"
android:orientation="vertical">
<ImageView
android:id="#+id/img_exchange"
android:layout_width="55dp"
android:layout_height="55dp"
android:background="#drawable/roundblue"
android:scaleType="center"
android:src="#drawable/exchange" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Exchange"
android:textColor="#color/black" />
</LinearLayout>
<LinearLayout
android:id="#+id/menu_health"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_toRightOf="#+id/menu_exchange"
android:orientation="vertical">
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:background="#drawable/roundblue"
android:scaleType="center"
android:src="#drawable/health" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Health"
android:textColor="#color/black" />
</LinearLayout>
<LinearLayout
android:id="#+id/menu_less"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_toRightOf="#+id/menu_health"
android:orientation="vertical">
<ImageView
android:id="#+id/img_less_more"
android:layout_width="55dp"
android:layout_height="55dp"
android:background="#drawable/roundblue"
android:scaleType="center"
android:src="#drawable/less" />
<TextView
android:id="#+id/txt_less_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Less"
android:textColor="#color/black" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:paddingLeft="15dp"
android:layout_marginRight="15dp"
android:id="#+id/layoutmenu2"
android:layout_below="#+id/layoutmenu1"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:id="#+id/menu_bank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/menu_offers"
android:layout_marginTop="10dp"
android:orientation="vertical">
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:background="#drawable/roundblue"
android:scaleType="center"
android:src="#drawable/bank" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Bank"
android:textColor="#color/black" />
</LinearLayout>
<LinearLayout
android:id="#+id/menu_sos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/menu_menu"
android:layout_marginLeft="13dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/menu_bank"
android:orientation="vertical">
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:background="#drawable/roundblue"
android:scaleType="center"
android:src="#drawable/sos" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="SOS"
android:textColor="#color/black" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_marginTop="10dp"
android:id="#+id/layoutImage"
app:layout_collapseMode="parallax"
android:layout_below="#+id/layoutmenu2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:src="#drawable/hospital_health"
android:scaleType="centerCrop"/>-->
<android.support.v4.view.ViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:background="#FFF"
android:layout_height="150dp">
</android.support.v4.view.ViewPager>
<com.viewpagerindicator.CirclePageIndicator
android:id="#+id/indicator"
android:layout_width="fill_parent"
android:layout_height="22dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="125dp"
android:padding="10dip"
app:centered="true"
app:fillColor="#FFFFFF"
app:snap="false" />
</RelativeLayout>
</RelativeLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<akhil.com.d4d.common.ExpandableHeightGridView
android:id="#+id/health_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:background="#E7E7E7"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:numColumns="2"
android:layout_weight="1">
</akhil.com.d4d.common.ExpandableHeightGridView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
<!--
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_health"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="akhil.com.d4d.activities.Health">
</RelativeLayout>-->

Collapsing Toolbar not collapsing completely when restored in a fragment from backstack

The collapsing toolbar gets stuck in mid way, when i restore the fragment(containing the collapsing toolbar) from back stack. It is collapsing perfectly initially, but when i put the fragment in back-stack, move to next fragment and come back to this fragment then it gets stuck mid-way
XML
<?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:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:minHeight="0dp"
app:elevation="0dp">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="200dp"
android:transitionName="frame_layout"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<TextView
android:id="#+id/tiffin_service_initials_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:background="#color/colorPrimary"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="AB"
android:textColor="#color/md_white_1000"
android:textSize="40sp"
android:transitionName="text_view" />
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:titleTextColor="#color/md_white_1000" />
</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"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="#+id/linear_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:cardCornerRadius="0dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:foreground="?selectableItemBackground"
android:gravity="center"
android:orientation="horizontal"
android:padding="16dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_star" />
<TextView
android:id="#+id/rating_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="4.7"
android:textSize="20sp" />
</LinearLayout>
<View
android:layout_width="0.2dp"
android:layout_height="match_parent"
android:alpha="0.5"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:foreground="?selectableItemBackground"
android:gravity="center"
android:orientation="horizontal"
android:padding="16dp">
<ImageView
android:layout_width="28dp"
android:layout_height="28dp"
android:scaleType="centerCrop"
android:src="#drawable/ic_call"
android:tint="#color/colorAccent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="#string/call"
android:textSize="20sp" />
</LinearLayout>
<View
android:layout_width="0.2dp"
android:layout_height="match_parent"
android:alpha="0.5"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:foreground="?selectableItemBackground"
android:gravity="center"
android:orientation="horizontal"
android:padding="16dp">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:scaleType="centerCrop"
android:src="#drawable/ic_chat"
android:tint="#color/md_blue_500" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="Chat"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
app:cardCornerRadius="0dp"
app:cardElevation="2dp">
<LinearLayout
android:id="#+id/menu_linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.5"
android:text="#string/menu"
android:textSize="20sp" />
<ProgressBar
android:id="#+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/menu_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:visibility="gone">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
app:cardCornerRadius="0dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:alpha="0.5"
android:text="#string/address"
android:textSize="20sp" />
<com.google.android.gms.maps.MapView
android:id="#+id/map_view"
android:layout_width="match_parent"
android:layout_height="200dp">
</com.google.android.gms.maps.MapView>
<TextView
android:id="#+id/address_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:textSize="12sp" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

how to hide image view on coordinate layout (like fab hide on scroll)?

I want to hide/disappear Image view(like fab) when its scroll as its coordinate layout behavior currently its behave like this first
while scroll
and this
and this is my layout xml
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/lyoutFeedLoadMore"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#FAFAFA"
android:gravity="center"
android:visibility="gone">
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:id="#+id/bottomView"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_alignParentBottom="true"
android:background="#color/white" />
<android.support.design.widget.CoordinatorLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.photex.urdu.textonphotos.activities.ScrollingActivity"
android:layout_above="#+id/bottomView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/main.appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:fitsSystemWindows="true"
android:orientation="vertical"
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="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white">
<FrameLayout
android:id="#+id/main.framelayout.title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/main.backCover"
android:layout_gravity="bottom"
android:layout_marginLeft="120dp"
android:layout_marginStart="120dp"
android:background="#color/white"
android:orientation="vertical"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.3">
<LinearLayout
android:id="#+id/pfInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txtCountPost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="-"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtPost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="post"
android:textColor="#android:color/black" />
</LinearLayout>
<LinearLayout
android:id="#+id/layout_followers"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txtCountFollowers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="-"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtFollowers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="followers"
android:textColor="#android:color/black" />
</LinearLayout>
<LinearLayout
android:id="#+id/layout_following"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txtCountFollowing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="-"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtFollowing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="following"
android:textColor="#android:color/black" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<LinearLayout
android:id="#+id/main.section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/main.framelayout.title"
android:layout_margin="16dp"
android:orientation="vertical">
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="nasdnfasdnfasdhfjasdhfahsdfahsdasdfa"
android:textColor="#android:color/black"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtBio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:maxLines="5"
android:text="fgsfgdfgsdfgdfg"
android:textColor="#android:color/black"
android:textSize="16sp"
android:visibility="visible" />
<TextView
android:id="#+id/txtFallowedBy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:maxLines="2"
android:text="Success Diaries"
android:textColor="#android:color/black"
android:textSize="16sp"
android:visibility="gone" />
</LinearLayout>
<Button
android:id="#+id/btnFollowEdit"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_below="#+id/main.section"
android:layout_centerInParent="true"
android:background="#drawable/bg_rectangle_white"
android:minWidth="150dp"
android:onClick="onClick"
android:text="Follow"
android:textColor="#android:color/black"
android:visibility="visible" />
<View
android:id="#+id/view"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_below="#+id/btnFollowEdit"
android:layout_marginBottom="12dp"
android:visibility="invisible" />
<ImageView
android:id="#+id/main.backCover"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="#drawable/sea"
app:layout_collapseMode="parallax" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbarUser"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay">
<TextView
android:id="#+id/txtNameToolbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#android:color/white"
android:textSize="18sp" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<ProgressBar
android:id="#+id/progressBarMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="300dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/rvFeeds"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/srlContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView
android:id="#+id/rvUserFeeds"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.v4.widget.SwipeRefreshLayout>
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/ivUserProfilePhoto"
android:layout_width="92dp"
android:layout_height="92dp"
android:layout_margin="#dimen/fab_margin"
android:src="#mipmap/ic_launcher"
app:civ_border_width="2dp"
app:layout_anchor="#id/main.backCover"
app:layout_anchorGravity="bottom|left|end" />
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
what i exactly want behavior like facebook scroll
first
on scrolling ]6
Try to make your Parent layout as android.support.design.widget.CoordinatorLayout then set all your content inside that layout Check this.
<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/appbar"
android:layout_width="match_parent"
android:layout_height="192dp"
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="?attr/colorPrimary"
app:expandedTitleMarginBottom="32dp"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/header"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="#+id/anim_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/scrollableview"
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_margin="#dimen/fab_margin"
android:clickable="true"
android:src="#drawable/ic_action_add"
app:layout_anchor="#+id/appbar"
app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>

android : NestedScrollview bottom two button attached

I am trying to create Android product layout. In footer have two buttons it is fixed button. you can see images when I am scrolling up bottom two buttons attached in my layout. Please help how can i do?
Image 1
Image 2
after scrolling
xml
<?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/coordinate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.chivazo.chivazoandroid.activities.SingleProductActivity">
<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:expandedTitleMarginBottom="30dp"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="#+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="#drawable/a"
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_single_product" />
<LinearLayout
android:id="#+id/groupbutton"
android:weightSum="2"
android:orientation="horizontal"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.AppCompatButton
android:layout_weight="1"
android:id="#+id/share"
android:text="share"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v7.widget.AppCompatButton
android:layout_weight="1"
android:id="#+id/go_wishlist"
android:text="go to Wishlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
You can use Relativelayout as your outer layout and keep CoordinatorLayout inside it, make Two buttons android:layout_alignParentBottom="true"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.CoordinatorLayout
android:id="#+id/coordinate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/groupbutton"
android:fitsSystemWindows="true"
tools:context="com.chivazo.chivazoandroid.activities.SingleProductActivity">
<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:expandedTitleMarginBottom="30dp"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="#+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="#drawable/a"
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_single_product" />
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:id="#+id/groupbutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:orientation="horizontal"
android:weightSum="2">
<android.support.v7.widget.AppCompatButton
android:id="#+id/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="share" />
<android.support.v7.widget.AppCompatButton
android:id="#+id/go_wishlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="go to Wishlist" />
</LinearLayout>
</RelativeLayout>
The app:layout_anchor="#id/anchor_view"
and
app:layout_anchorGravity="bottom"
are the Important attributes here
<android.support.design.widget.CoordinatorLayout
android:id="#+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".ProductDetailActivity">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorPrimary"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
.
.
.
<View
android:id="#+id/anchor_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
.
.
.
.
</android.support.v4.widget.NestedScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_anchor="#id/anchor_view"
app:layout_anchorGravity="bottom">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Simply add your layout in Coordinatorlayout below NestedScrollView in xml and do the following in java.
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) layoutToBeAnchored.getLayoutParams();
layoutParams.setAnchorId(R.id.layoutBelowWhichToBeAnchored);
layoutParams.anchorGravity = Gravity.CENTER;
layoutToBeAnchored.setLayoutParams(layoutParams);
Hope this helps you guys. For any reference you can check the example at -
https://github.com/IsUncommon/Droidcon-India-2015
If your included layout layout="#layout/content_single_product" contains a NestedScrollView as a root view container. Try to add an id to it like #+id/nestedView with android:layout_height="match_parent", You must probably add bottom padding with the same height value of your buttons , and Just keep the rest as it is, and replace android:layout_gravity="bottom" inside your bottom linear layout which contains the two buttons with :
app:layout_anchor="#id/nestedView"
app:layout_anchorGravity="bottom"
<RelativeLayout
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.support.design.widget.CoordinatorLayout
android:id="#+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="#+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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:background="#android:color/transparent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="center_vertical|start"
app:expandedTitleTextAppearance="#android:color/transparent"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:id="#+id/lay_image_slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/browseCategories"
android:background="#color/white">
<FrameLayout
android:id="#+id/rel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:orientation="vertical">
<com.example.android_dev.ecm.View.ViewPagerCustomDuration
android:id="#+id/pager"
android:layout_width="fill_parent"
android:layout_height="300dp" />
<com.example.android_dev.ecm.View.CirclePageIndicator
android:id="#+id/indicator"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#android:color/transparent"
android:padding="10dp" />
</FrameLayout>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbarSeller"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="56dp"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include
android:id="#+id/contentScroll"
layout="#layout/content_scroll_product_detail" />
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_gravity="center"
android:background="#drawable/shadow" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:id="#+id/addToCart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/white"
android:text="Add To Cart"
android:textColor="#color/black"
android:textSize="16sp" />
<!--<Button
android:id="#+id/addToWishList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/colorAccent"
android:text="Add To Wishlist"
android:textColor="#color/white" />-->
<Button
android:id="#+id/buyNow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/colorPrimary"
android:text="Buy Now"
android:textColor="#color/white"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
content_scroll_product_detail.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:expandableTextView="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="com.example.android_dev.ecm.Helper.FixedScrollingViewBehaviour">
<android.support.v4.widget.NestedScrollView
android:id="#+id/nestedScroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="#+id/productDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/productTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:textColor="#color/black"
android:textSize="18sp" />
<TextView
android:id="#+id/productName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="2dp"
android:textSize="16sp" />
<RelativeLayout
android:id="#+id/priceLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/productDiscountPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:textColor="#color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/productPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/productDiscountPrice"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:textColor="#color/gray"
android:textSize="14sp" />
<LinearLayout
android:id="#+id/ratingProduct"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<TextView
android:id="#+id/rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="10dp"
android:text="3.2"
android:textColor="#color/colorAccent"
android:textSize="22sp" />
<RatingBar
android:id="#+id/star"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/rating"
android:isIndicator="true"
android:numStars="1"
android:rating="1" />
</LinearLayout>
<LinearLayout
android:id="#+id/sold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/productPrice"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sold by : "
android:textColor="#color/gray"
android:textSize="14sp" />
<TextView
android:id="#+id/soldBy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/gray"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="#+id/orders"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/sold"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:text="Additional tax may apply charged at checkout"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:weightSum="1">
<Button
android:id="#+id/share"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:background="#drawable/lay_border"
android:drawableLeft="#drawable/shareic"
android:drawablePadding="-20dp"
android:gravity="center"
android:paddingLeft="8dp"
android:text="Share"
android:textColor="#color/black" />
<Button
android:id="#+id/addToWishList"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:background="#drawable/lay_border"
android:drawableLeft="#drawable/pinic"
android:drawablePadding="-10dp"
android:gravity="center"
android:paddingLeft="8dp"
android:text="Add To Pinlist"
android:textColor="#color/black" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/ratingSeller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/productDetails">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dp">
</RelativeLayout>
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/outOfStock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/ratingSeller"
android:background="#color/light_red"
android:gravity="center"
android:text="Sorry this product is out of stock."
android:textColor="#color/white"
android:textSize="22sp"
android:visibility="gone" />
<android.support.v7.widget.CardView
android:id="#+id/productVariants"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/outOfStock"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/addAttributesHere"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:id="#+id/saveButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/productVariants"
android:orientation="horizontal"
android:visibility="gone"
android:weightSum="2">
<Button
android:id="#+id/add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/black"
android:text="Add To Cart"
android:textColor="#color/white" />
<!-- <Button
android:id="#+id/save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/colorAccent"
android:text="Add To Wishlist"
android:textColor="#color/white" />-->
<Button
android:id="#+id/buyNow2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/colorAccent"
android:text="Buy Now"
android:textColor="#color/white" />
</LinearLayout>
<android.support.v7.widget.CardView
android:id="#+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/saveButtons"
android:layout_marginTop="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Description"
android:textColor="#color/black"
android:textSize="16sp"
android:textStyle="bold" />
<com.ms.square.android.expandabletextview.ExpandableTextView
android:id="#+id/expand_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
expandableTextView:animDuration="200"
expandableTextView:maxCollapsedLines="2">
<TextView
android:id="#+id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:textColor="#color/black"
android:textSize="14sp" />
<ImageButton
android:id="#id/expand_collapse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:background="#android:color/transparent"
android:padding="16dp" />
</com.ms.square.android.expandabletextview.ExpandableTextView>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/recommend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/description"
android:layout_marginTop="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white">
<TextView
android:id="#+id/recommendHead"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="Recommendation"
android:textColor="#color/black"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/recommendText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/recommendHead"
android:padding="10dp"
android:text="Would you like to recommend this product?"
android:textColor="#color/gray"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/recommendText"
android:layout_marginBottom="5dp"
android:background="#drawable/lay_border"
android:weightSum="2">
<Button
android:id="#+id/yes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:background="#deffffff"
android:text="Yes"
android:textColor="#color/colorPrimary"
android:textSize="18sp" />
<Button
android:id="#+id/no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="1"
android:background="#f7f5f5"
android:text="No"
android:textColor="#color/colorPrimary"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/productSellers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/recommend"
android:layout_marginTop="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/addSellersHere"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>

Categories

Resources