And I used app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
but here toolbar is transparent.
Am using above XML layout I fragment because my requirement is I need different layout in fragment. Any help will be appreciated.
ToolBar Issue in cordinatelayout
Here is my code:
<?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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="#dimen/detail_backdrop_height"
android:theme="#style/ThemeOverlay.AppCompat"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<ImageView
android:id="#+id/backdrop_BannerImage_Id"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
android:src="#drawable/grass_background"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_event_home_Id"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#drawable/cast_expanded_controller_actionbar_bg_gradient_light"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="parallax" />
</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: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_margin="5dp"
app:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/event_name_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:gravity="center_horizontal"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/event_date_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/event_name_text_view"
android:layout_margin="10dp"
android:text="21-08-2016"
android:textSize="14sp" />
<TextView
android:id="#+id/event_attendee_count_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_below="#+id/event_name_text_view"
android:layout_margin="10dp"
android:text="1000"
android:textSize="14sp" />
<!-- <Button
android:id="#+id/event_book_now_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/event_date_text_view"
android:layout_margin="15dp"
android:background="#color/primary"
android:text="Book Now"
android:textColor="#color/background_color" />-->
<View
android:id="#+id/event_info_view_line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/event_attendee_count_text_view"
android:background="#cccccc" />
<LinearLayout
android:id="#+id/sub_linearLayout_1_day_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/event_info_view_line"
android:layout_margin="15dp"
android:orientation="horizontal">
<TextView
android:id="#+id/event_info_day_time_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/event_info_day_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="21-08-2016" />
<!--<TextView
android:id="#+id/event_info_days_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2 days"
android:layout_marginStart="150dp"/>-->
</LinearLayout>
<LinearLayout
android:id="#+id/sub_linearLayout_2_place_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/sub_linearLayout_1_day_id"
android:layout_marginStart="15dp">
<TextView
android:id="#+id/event_info_location_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/event_info_location_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="21-08-2016" />
</LinearLayout>
<FrameLayout
android:id="#+id/map_event_info"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_below="#id/sub_linearLayout_2_place_id"
android:gravity="center"
android:orientation="horizontal"
android:padding="5dp"></FrameLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:elevation="10dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="#dimen/card_margin"
android:layout_marginLeft="#dimen/card_margin"
android:layout_marginRight="#dimen/card_margin"
android:layout_marginTop="#dimen/card_margin"
android:orientation="vertical">
<TextView
android:id="#+id/event_info_details_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Details"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="#+id/event_info_details_text_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingButtonEventInfoId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="160dp"
android:layout_gravity="bottom|end"
android:layout_marginRight="#dimen/fab_margin"
android:visibility="invisible"
app:elevation="6dp"
app:pressedTranslationZ="12dp" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingButtonEventInfoFeedBackId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="90dp"
android:layout_gravity="bottom|end"
android:layout_marginRight="#dimen/fab_margin"
android:visibility="invisible"
app:elevation="6dp"
app:pressedTranslationZ="12dp" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingButtonEventInfoShareId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:elevation="6dp"
app:backgroundTint="#color/colorAccent"
app:pressedTranslationZ="12dp"
android:layout_margin="#dimen/fab_margin" />
</android.support.design.widget.CoordinatorLayout>
yours toolbar background is messing with yours collapsingtoolbarlayout
android:background="#drawable/cast_expanded_controller_actionbar_bg_gradient_light"
Try to remove it and run.
Related
Here is xml of my layout having CollapsingToolbar and viewpager. I am using NestedScrollViews so that the CollapsingToolbarLayout, swipetoreferesh and viewpager work smoothly.
<layout 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">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".wallet_staking_survey.ui.survey_main.SurveyMain2Fragment">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appBarlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:fitsSystemWindows="true"
app:contentScrim="#color/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="#dimen/_260sdp"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="#drawable/bg_kyc_progress_level"
app:layout_collapseMode="parallax" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/_20sdp"
android:orientation="vertical">
<com.realresearch.survey.customviews.DonutProgress
android:id="#+id/levelProgress"
android:layout_width="#dimen/_180sdp"
android:layout_height="#dimen/_180sdp"
android:layout_gravity="center"
app:donut_background_color="#android:color/transparent"
app:donut_circle_starting_degree="270"
app:donut_finished_color="#color/md_light_green_300"
app:donut_finished_stroke_width="5dp"
app:donut_text=""
app:donut_unfinished_color="#color/md_grey_100"
app:donut_unfinished_stroke_width="5dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/tvLevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/recipekorea"
android:text="#string/level_2"
android:textColor="#android:color/white"
android:textSize="#dimen/_24sdp" />
<LinearLayout
android:id="#+id/llKycLevelProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/tvUpgradKyc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:fontFamily="#font/recipekorea"
android:text="#string/try_updating_your_kyc_level"
android:textColor="#android:color/white"
android:textSize="#dimen/_14sdp" />
<ImageView
android:id="#+id/ivHelp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:layout_marginStart="#dimen/_4sdp"
android:src="#drawable/ic_baseline_help_24"
android:text="#string/try_updating_your_kyc_level"
android:textColor="#android:color/white"
android:textSize="#dimen/_14sdp" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<androidx.cardview.widget.CardView
android:id="#+id/cv_wallet_balance"
android:layout_width="match_parent"
android:layout_height="#dimen/_60sdp"
android:layout_marginStart="#dimen/_30sdp"
android:layout_marginTop="#dimen/_230sdp"
android:layout_marginEnd="#dimen/_30sdp"
android:layout_marginBottom="#dimen/_10sdp"
app:cardCornerRadius="#dimen/_35sdp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:fontFamily="#font/recipekorea"
android:text="#string/my_tnc"
android:textColor="#color/textColor"
android:textSize="#dimen/_16sdp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/title">
<TextView
android:id="#+id/tvMyTNCBalance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/recipekorea"
android:gravity="center"
android:text="10,000"
android:textColor="#color/pinkRed"
android:textSize="#dimen/_20sdp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_5sdp"
android:fontFamily="#font/recipekorea"
android:text="#string/tnc"
android:textColor="#color/md_grey_400" />
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</com.google.android.material.appbar.CollapsingToolbarLayout>
<!--- ADD TAB_LAYOUT HERE-->
<com.google.android.material.tabs.TabLayout
android:id="#+id/surveyTabs"
android:layout_width="match_parent"
android:layout_height="40dp"
android:fillViewport="true"
app:tabGravity="fill"
app:tabMode="scrollable" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:clipToPadding="false"
android:fillViewport="true"
android:isScrollContainer="false"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="#+id/swipe_to_refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.core.widget.NestedScrollView
android:id="#+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:fillViewport="true"
android:isScrollContainer="false">
<androidx.viewpager2.widget.ViewPager2
android:id="#+id/surveyFilterPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
I am using single fragment having a recyclerview to show three fragments in viewpager i.e. FragmentA, FragmentB, and FragmentC. Now the problem is FragmentB takes height equals to the content of FragmentA resulting in empty scrollable spaces in FragmentB. Same is the case with FragmentC. Below is the xml of my Fragment having recyclerview.
<layout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="3">
<LinearLayout
android:id="#+id/ll_no_survey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/_50sdp"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<ImageView
android:layout_width="#dimen/_60sdp"
android:layout_height="#dimen/_60sdp"
android:src="#drawable/ic_info" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:fontFamily="#font/open_sans_semi_bold"
android:text="#string/no_survey_response"
android:textColor="#color/defaultTextColor"
android:textSize="17.3sp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/survey_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="visible" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="#font/open_sans_semi_bold"
android:text="#string/all_surveys"
android:textColor="#color/c_0078AB"
android:textSize="17.3sp"
android:visibility="gone" />
</RelativeLayout>
</layout>
Please help me as i am not able to find any solution.
The second NestedScrollView seems to be unnecessary, you can try something like the following codes:
<androidx.coordinatorlayout.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">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appBarlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:fitsSystemWindows="true"
app:contentScrim="#color/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="#dimen/_260sdp"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/_20sdp"
android:orientation="vertical">
<com.realresearch.survey.customviews.DonutProgress
android:id="#+id/levelProgress"
app:donut_background_color="#android:color/transparent"
app:donut_circle_starting_degree="270"
app:donut_finished_color="#color/md_light_green_300"
app:donut_finished_stroke_width="5dp"
app:donut_text=""
app:donut_unfinished_color="#color/md_grey_100"
app:donut_unfinished_stroke_width="5dp"
android:layout_width="#dimen/_180sdp"
android:layout_height="#dimen/_180sdp"
android:layout_gravity="center" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/tvLevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="level_2"
android:textColor="#android:color/white"
android:textSize="#dimen/_24sdp" />
<LinearLayout
android:id="#+id/llKycLevelProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/tvUpgradKyc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:text="try_updating_your_kyc_level"
android:textColor="#android:color/white"
android:textSize="#dimen/_14sdp" />
<ImageView
android:id="#+id/ivHelp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_4sdp"
android:layout_marginTop="#dimen/_5sdp"
android:src="#drawable/ic_baseline_help_24"
android:text="try_updating_your_kyc_level"
android:textColor="#android:color/white"
android:textSize="#dimen/_14sdp" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<androidx.cardview.widget.CardView
android:id="#+id/cv_wallet_balance"
android:layout_width="match_parent"
android:layout_height="#dimen/_60sdp"
android:layout_marginStart="#dimen/_30sdp"
android:layout_marginTop="#dimen/_230sdp"
android:layout_marginEnd="#dimen/_30sdp"
android:layout_marginBottom="#dimen/_10sdp"
app:cardCornerRadius="#dimen/_35sdp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="my_tnc"
android:textSize="#dimen/_16sdp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/title">
<TextView
android:id="#+id/tvMyTNCBalance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="10,000"
android:textSize="#dimen/_20sdp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_5sdp"
android:text="tnc" />
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
<!--- ADD TAB_LAYOUT HERE-->
<com.google.android.material.tabs.TabLayout
android:id="#+id/surveyTabs"
android:layout_width="match_parent"
android:layout_height="40dp"
android:fillViewport="true"
app:tabGravity="fill"
app:tabMode="scrollable" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="#+id/swipe_to_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<androidx.core.widget.NestedScrollView
android:id="#+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<androidx.viewpager2.widget.ViewPager2
android:id="#+id/surveyFilterPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
In my online food ordering app,in food detail section the image is not in right position.I am importing it from firebase database.
This is my fooddetail.java code
<?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"
tools:context="com.example.admin.clicknorder.FoodDetail"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar_layout"
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"
android:layout_width="match_parent"
android:layout_height="350dp"
app:layout_scrollFlags="exitUntilCollapsed"
app:contentScrim="#0d0e0d"
app:expandedTitleTextAppearance="#android:color/transparent"
>
</android.support.design.widget.CollapsingToolbarLayout>
<ImageView
android:id="#+id/image_food"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="#null"
app:layout_collapseMode="parallax"
android:scaleType="fitXY"
/>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:title="Food Name"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="parallax"
/>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/btnCart"
app:srcCompat="#drawable/ic_shopping_cart_black_24dp"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
app:layout_anchor="#id/app_bar_layout"
app:layout_anchorGravity="bottom|right|end"
app:useCompatPadding="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v4.widget.NestedScrollView
android:id="#+id/nesterScrollView"
android:clipToPadding="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="5dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/food_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:padding="12dp"
android:text="Food Name"
android:textColor="#color/colorPrimary"
android:textSize="20sp"
android:textStyle="bold" />
<LinearLayout
android:orientation="horizontal"
android:id="#+id/layout_price"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
app:srcCompat="#drawable/ic_attach_money_black_24dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/food_price"
android:layout_weight="9"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="1,000"
android:textColor="#color/colorPrimary"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<com.cepheuen.elegantnumberbutton.view.ElegantNumberButton
android:layout_width="100dp"
android:layout_height="30dp"
android:id="#+id/number_button"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:layout_marginBottom="18dp"
app:textSize="8sp"
app:backGroundColor="#color/colorAccent"
app:initialNumber="1"
app:finalNumber="20"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
app:cardElevation="5dp"
app:cardUseCompatPadding="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/food_description"
android:layout_marginTop="12dp"
android:lineSpacingMultiplier="1.5"
android:padding="12dp"
android:text="description"
android:textColor="#android:color/black"
android:textSize="14sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
I don't know what is happening but if it is anything related to image resolution and size,please tell how can i fix it from android studio itself.
If any more details will require...i will edit my question.
Thank you
You have just placed your ImageView and Toolbar in wrong place
Move your image_food ImageView and Toolbar inside CollapsingToolbarLayout
Change your layout like below code
<?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_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title=""
app:titleEnabled="false">
<ImageView
android:id="#+id/image_food"
android:layout_width="match_parent"
android:layout_height="256dp"
android:contentDescription="#null"
android:scaleType="fitXY"
android:src="#drawable/kid_goku"
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>
<android.support.design.widget.FloatingActionButton
android:id="#+id/btnCart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:elevation="6dp"
app:layout_anchor="#id/app_bar_layout"
app:layout_anchorGravity="bottom|right|end"
app:pressedTranslationZ="12dp"
app:srcCompat="#drawable/ic_message"
app:useCompatPadding="true" />
<android.support.v4.widget.NestedScrollView
android:id="#+id/nesterScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="5dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/food_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:padding="12dp"
android:text="Food Name"
android:textColor="#color/colorPrimary"
android:textSize="20sp"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/layout_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="#drawable/ic_search" />
<TextView
android:id="#+id/food_price"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="9"
android:text="1,000"
android:textColor="#color/colorPrimary"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<com.cepheuen.elegantnumberbutton.view.ElegantNumberButton
android:id="#+id/number_button"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_marginBottom="18dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
app:backGroundColor="#color/colorAccent"
app:finalNumber="20"
app:initialNumber="1"
app:textSize="8sp" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="5dp"
app:cardUseCompatPadding="true">
<TextView
android:id="#+id/food_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:lineSpacingMultiplier="1.5"
android:padding="12dp"
android:text="description"
android:textColor="#android:color/black"
android:textSize="14sp" />
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
RESULT
https://i.stack.imgur.com/j1sPI.png
Please see the link for layout
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
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="match_parent"
app:contentScrim="#80000000"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin">
<ImageView
android:id="#+id/user_profile_empty"
android:layout_width="match_parent"
android:layout_height="#dimen/secondaryPhotoWidth"
android:scaleType="centerCrop"
android:visibility="gone" />
<android.support.v4.view.ViewPager
android:id="#+id/photo_pager"
android:layout_width="match_parent"
android:layout_height="#dimen/secondaryPhotoWidth" />
<com.ogaclejapan.smarttablayout.SmartTabLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/viewpagertab"
android:layout_width="wrap_content"
android:layout_height="#dimen/Profile.List.Item.Edit.Margin.Left"
android:layout_alignBottom="#+id/photo_pager"
android:layout_alignRight="#+id/photo_pager"
android:layout_gravity="bottom"
android:layout_marginBottom="#dimen/Profile.List.Item.Edit.Margin.Left"
android:layout_marginRight="#dimen/Profile.List.Item.Edit.Margin.Left"
android:layout_marginTop="#dimen/Profile.List.Item.Edit.Margin.Left"
app:stl_customTabTextLayoutId="#layout/custom_tab_circle"
app:stl_dividerColor="#color/transparent"
app:stl_dividerThickness="0dp"
app:stl_indicatorColor="#color/Sapio.RED"
app:stl_indicatorCornerRadius="#dimen/Profile.List.Item.Edit.Margin.Left"
app:stl_indicatorInterpolation="linear"
app:stl_indicatorThickness="#dimen/Profile.List.Item.Edit.Margin.Left"
app:stl_underlineColor="#color/transparent"
app:stl_underlineThickness="0dp" />
</RelativeLayout>
<!--<android.support.v7.widget.Toolbar-->
<!--android:id="#+id/MyToolbar"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="80dp"-->
<!--app:layout_collapseMode="parallax"/>-->
<RelativeLayout
android:id="#+id/likeIgnore_name_view"
android:layout_width="match_parent"
android:layout_height="#dimen/secondaryPhotoWidth">
<LinearLayout
android:id="#+id/like_ignor_view_upper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:layout_marginRight="15dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/skip_button"
android:layout_width="45dp"
android:layout_height="45dp"
android:src="#drawable/close" />
<ImageView
android:id="#+id/superLikeImage"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginLeft="#dimen/Default.PaddingMargin.Small"
android:src="#drawable/super_like" />
<ImageView
android:id="#+id/like_button"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginLeft="#dimen/Default.PaddingMargin.Small"
android:src="#drawable/heart" />
</LinearLayout>
<LinearLayout
android:id="#+id/nameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:layout_marginLeft="25dp"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/nameView_margin"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="visible" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingLeft="#dimen/abc_action_bar_subtitle_bottom_margin_material"
android:paddingRight="#dimen/abc_action_bar_subtitle_bottom_margin_material"
android:layout_weight="1"
android:gravity="center"
android:singleLine="true"
android:text="abc,31"
android:textColor="#color/Header.Text"
android:textSize="#dimen/Registration.Button.TextSize"
android:textStyle="bold" />
<TextView
android:id="#+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingLeft="#dimen/abc_action_bar_subtitle_bottom_margin_material"
android:paddingRight="#dimen/abc_action_bar_subtitle_bottom_margin_material"
android:layout_weight="1"
android:gravity="center"
android:singleLine="true"
android:text="abc,31"
android:textColor="#color/Header.Text"
android:textSize="#dimen/Registration.Button.TextSize" />
</LinearLayout>
</LinearLayout>
<Button
android:id="#+id/refine_matches_view"
style="#style/TextAppearanceThin"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginTop="20dp"
android:background="#drawable/filter_shape"
android:gravity="center"
android:minHeight="0dp"
android:text="#string/filter"
android:textAllCaps="false"
android:textColor="#android:color/white"
android:textSize="#dimen/LoginScreen.Button.TextSize"
android:visibility="visible" />
<ImageButton
android:id="#+id/more_button"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
android:background="#drawable/ic_more_vert_white_36dp"
android:gravity="center"
android:minHeight="0dp"
android:src="#drawable/filter_shape"
android:visibility="visible" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/MyToolbar"
android:layout_width="match_parent"
android:layout_height="80dp"
app:layout_collapseMode="parallax"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<ImageView
android:id="#+id/user_photo"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"
android:scaleType="fitCenter"
android:src="#drawable/match_bg"
android:visibility="visible"
app:elevation="10dp"
app:layout_anchor="#id/nameView"
app:layout_anchorGravity="bottom"/>
</android.support.design.widget.CoordinatorLayout>
<include
android:id="#+id/empty_profile_view"
layout="#layout/section_empty_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
please help me to achieve above type from layout.As i have tried as above and when scrolling the image view go inside the toolbar and half of the image view not visible.
you can follow this link.
http://www.journaldev.com/13927/android-collapsingtoolbarlayout-example
<?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"
tools:context="com.journaldev.collapsingtoolbarlayout.ScrollingActivity">
<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">
<ImageView
android:id="#+id/expandedImage"
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:src="#drawable/photo"
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"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_scrolling" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="#dimen/fab_margin"
app:layout_anchor="#id/app_bar"
app:layout_anchorGravity="bottom|end"
app:srcCompat="#android:drawable/ic_dialog_info" />
</android.support.design.widget.CoordinatorLayout>
hopefully you will be helpe from it.
Actually the appbar is already having the elevation that's why it makes all the views to gets inside of itself.
So just you need to give app:elevation="0dp" to the appbar layout. It gives all other views freedom to stay over itself.
When i add the background item in my theme than the BottomNavigationView is disappear.
#color/primary_red
#color/primary_red
and bottomnavigationview
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_gravity="bottom"
design:menu="#menu/bottom_menu_bar" />
When I remove the background item from the theme then it looks like
there is blank space between the window and bottom bar. And also background text is also appearing in foreground. How to remove that.
edit
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:design="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="RtlHardcoded"
android:background="#color/primary_background"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.design.widget.AppBarLayout
android:scrollbars="none"
android:id="#+id/main.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/main.collapsing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
//some code_1
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.Toolbar
android:visibility="invisible"
android:id="#+id/main.toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_anchor="#id/main.framelayout.title"
app:theme="#style/ThemeOverlay.AppCompat.Dark"
app:title="Dashboard">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<Space
android:layout_width="60dp"
android:layout_height="60dp"
/>
<TextView
android:id="#+id/main.textview.title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:gravity="center_vertical"
android:text="#string/user_name_demp"
android:textColor="#android:color/white"
android:textSize="20sp"
/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
<ImageView
android:layout_marginBottom="#dimen/activity_horizontal_margin"
android:layout_marginStart="#dimen/activity_horizontal_margin"
android:background="#drawable/circle"
android:id="#+id/profile_pic"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="left"
app:layout_behavior="profile.AvatarImageBehavior"
app:finalHeight="32dp"
app:finalYPosition="2dp"
app:startHeight="15dp"
app:startToolbarPosition="10dp"
app:startXPosition="10dp"/>
<android.support.design.widget.BottomNavigationView
android:background="#color/green"
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_gravity="bottom"
design:menu="#menu/bottom_menu_bar" />
<android.support.v4.widget.NestedScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_marginTop="#dimen/activity_horizontal_margin"
android:textStyle="bold"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textColor="#color/primary_text"
android:text="#string/health_vitals"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:background="#color/primary_text"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--First Sub Block-->
<LinearLayout
android:layout_weight="1"
android:layout_marginRight="1sp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<customView.healthVitalBlockDashboard
android:id="#+id/bp_block"
android:layout_width="match_parent"
android:layout_height="match_parent">
</customView.healthVitalBlockDashboard>
</LinearLayout>
<!--Second Sub Block-->
<LinearLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<customView.healthVitalBlockDashboard
android:id="#+id/bsl_block"
android:layout_width="match_parent"
android:layout_height="match_parent">
</customView.healthVitalBlockDashboard>
</LinearLayout>
</LinearLayout>
<TextView
android:paddingTop="#dimen/activity_horizontal_margin"
android:layout_marginBottom="1dp"
android:gravity="center"
android:textColor="#color/primary_text"
android:textStyle="bold"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:text="#string/reminder"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="#+id/medicine_list"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
<TextView
android:paddingTop="8dp"
android:paddingBottom="22dp"
android:id="#+id/reminderWarning"
android:visibility="gone"
android:gravity="center"
android:textColor="#color/primary_text"
android:textStyle="bold"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Small"
android:text="#string/reminder_warning"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:paddingTop="#dimen/activity_horizontal_margin"
android:layout_marginBottom="1dp"
android:id="#+id/adherence_text"
android:textStyle="bold"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textColor="#color/primary_text"
android:text="#string/adherence"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:background="#color/primary_text"
android:layout_below="#+id/adherence_text"
android:id="#+id/action_with_adherence"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
<TextView
android:paddingTop="8dp"
android:paddingBottom="22dp"
android:id="#+id/adherence_warning"
android:visibility="gone"
android:gravity="center"
android:textColor="#color/primary_text"
android:textStyle="bold"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Any leads will be helpfull!!!
i am using this code and it works well, try to change yours as your project matches.
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="#menu/navigation"/>
Nested ScrollView has fragments which have RecyclerView and AppbarLayout does not scroll when dragged.
I have even added app:layout_behavior="#string/appbar_scrolling_view_behavior" in my RecyclerView as suggested in some answer but that does not work.
<android.support.design.widget.CoordinatorLayout
android:id="#+id/profile_view_cl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/color_control_highlight"
android:fitsSystemWindows="true"
android:focusableInTouchMode="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin_8dp"
app:layout_behavior="com.practo.docnet.widgets.FlingBehavior"
android:theme="#style/Theme.AppCompat.NoActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_tool_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:contentScrim="#color/color_primary"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/color_white"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.5">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center_horizontal"
android:layout_marginBottom="#dimen/profile_pic_margin_bottom"
android:layout_marginTop="#dimen/profile_pic_margin_top"
android:background="#android:color/white"
android:elevation="#dimen/card_padding"
android:gravity="center_horizontal|top"
app:cardCornerRadius="#dimen/default_elevation"
app:cardUseCompatPadding="false">
<ImageView
android:id="#+id/profile_pic_iv"
android:layout_width="#dimen/profile_pic_size"
android:layout_height="#dimen/profile_pic_size"
android:layout_gravity="center_horizontal"
android:layout_margin="#dimen/profile_pic_margin"
android:adjustViewBounds="true"
android:scaleType="fitXY"
/>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:orientation="vertical">
<ImageView
android:id="#+id/cover_pic"
android:layout_width="match_parent"
android:layout_height="#dimen/cover_pic_height"
android:layout_gravity="top"
android:fitsSystemWindows="true"
android:scaleType="fitXY"
android:src="#drawable/profile_placeholder"
android:tint="#color/cover_pic_tint" />
<LinearLayout
android:id="#+id/layout_titles"
android:layout_width="wrap_content"
android:layout_height="#dimen/titles_layout_height"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/titles_layout_margin_top"
android:orientation="vertical">
<TextView
android:id="#+id/first_name_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="sans-serif"
android:gravity="bottom|center"
android:textColor="#color/color_black"
android:textSize="#dimen/text_sz_xxxlarge" />
<TextView
android:id="#+id/designation_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/designation_text_margin_top"
android:fontFamily="sans-serif-light"
android:textColor="#color/color_black"
android:textSize="#dimen/text_sz_xlarge" />
<TextView
android:id="#+id/location_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/location_text_margin_top"
android:fontFamily="sans-serif-light"
android:textColor="#color/color_black"
android:textSize="#dimen/text_sz_xlarge" />
<TextView
android:id="#+id/no_of_connections_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/card_padding_more"
android:background="?selectableItemBackground"
android:fontFamily="sans-serif-medium"
android:textColor="#color/color_primary"
android:textSize="#dimen/text_sz_xxlarge" />
<TextView
android:id="#+id/connections_text_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/connections_text_margin_top"
android:background="?selectableItemBackground"
android:fontFamily="sans-serif-light"
android:text="#string/connections"
android:textColor="#color/color_black"
android:textSize="#dimen/text_sz_xlarge" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="center_horizontal"
app:layout_collapseMode="pin"
app:navigationIcon="#drawable/back_icon"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
<TextView
android:id="#+id/title_textview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/margin_8dp"
android:gravity="center_vertical"
android:textColor="#android:color/white"
android:textSize="#dimen/text_sz_xxlarge" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foregroundGravity="fill_vertical"
android:layout_marginTop="#dimen/margin_8dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="#+id/cards_layout_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:focusableInTouchMode="true"
android:orientation="vertical">
<include layout="#layout/profile_connect_layout" />