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" />
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
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"/>
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.
I am trying to create something like this
<android.support.design.widget.CoordinatorLayout
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<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">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<FrameLayout
android:id="#+id/frameAdvertiseSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_scrollFlags="scroll|snap">
<android.support.v4.view.ViewPager
android:id="#+id/viewPagerAdvertiseSlider"
android:layout_width="match_parent"
android:layout_height="#dimen/pager_advertise_slider_height"
android:layout_gravity="top" />
<com.viewpagerindicator.CirclePageIndicator
android:id="#+id/indicatorAdvertiseSlider"
style="#style/IntroPageIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="#dimen/margin_medium" />
</FrameLayout>
<LinearLayout
android:id="#+id/linearLayoutMainCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_mini_small"
android:orientation="horizontal"
app:layout_scrollFlags="scroll|snap">
<Button
android:id="#+id/buttonMainCategory1"
style="#style/ButtonHomeStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="#drawable/ic_category"
android:paddingBottom="12dp"
android:paddingTop="15dp"
android:text="#string/home_category_category" />
<Button
android:id="#+id/buttonMainCategory2"
style="#style/ButtonHomeStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="1dp"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:drawablePadding="5dp"
android:drawableTop="#drawable/ic_action"
android:paddingTop="15dp"
android:text="#string/home_category_action" />
<Button
android:id="#+id/buttonMainCategory3"
style="#style/ButtonHomeStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="1dp"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:drawablePadding="5dp"
android:drawableTop="#drawable/ic_new"
android:paddingTop="15dp"
android:text="#string/home_category_new" />
<Button
android:id="#+id/buttonMainCategory4"
style="#style/ButtonHomeStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="1dp"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:drawablePadding="5dp"
android:drawableTop="#drawable/ic_most_selling"
android:paddingTop="5dp"
android:text="#string/home_category_most_selling" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayoutBanners"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin_mini_small"
android:layout_marginTop="#dimen/margin_mini_small"
android:orientation="horizontal"
app:layout_scrollFlags="scroll|snap">
<ImageView
android:id="#+id/imageBanner1"
android:layout_width="0dp"
android:layout_height="#dimen/banner1_height"
android:layout_weight="1"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="#dimen/banner1_height"
android:layout_marginLeft="1dp"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="#+id/imageBanner2"
android:layout_width="match_parent"
android:layout_height="#dimen/banner2_height"
android:scaleType="fitXY" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#00000000" />
<ImageView
android:id="#+id/imageBanner3"
android:layout_width="match_parent"
android:layout_height="#dimen/banner2_height"
android:scaleType="fitXY" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_scrollFlags="scroll|snap"
android:layout_marginBottom="#dimen/margin_mini_small">
<android.support.design.widget.TabLayout
android:id="#+id/tabLayoutNews"
android:layout_width="match_parent"
android:layout_height="#dimen/tabs_height"
android:background="#color/white"
app:tabIndicatorColor="#color/main_color"
app:tabMode="fixed"
app:tabSelectedTextColor="#color/home_tab_color"
app:tabTextColor="#color/home_tab_color" />
<android.support.v4.view.ViewPager
android:id="#+id/viewPagerNews"
android:layout_width="match_parent"
android:layout_height="#dimen/news_pager_height"/>
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.design.widget.TabLayout
android:id="#+id/tabLayoutPager"
android:layout_width="match_parent"
android:layout_height="#dimen/tabs_height"
android:background="#color/white"
app:tabGravity="center"
app:tabIndicatorColor="#color/main_color"
app:tabMode="scrollable"
app:tabSelectedTextColor="#color/home_tab_color"
app:tabTextColor="#color/home_tab_color" />
<android.support.v4.view.ViewPager
android:id="#+id/viewPagerTabs"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="#drawable/home_profile_background" />
<LinearLayout
android:id="#+id/linearProfile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/margin_medium"
android:orientation="vertical">
<rs.netlink.android.widgets.CircleImageView
android:id="#+id/circleImageViewProfile"
android:layout_width="#dimen/profile_image_size"
android:layout_height="#dimen/profile_image_size"
android:scaleType="centerCrop"
android:src="#drawable/default_profile_image"
app:border_color="#color/home_profile_image_ellipse"
app:border_width="1dp" />
<TextView
android:id="#+id/textName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_small_medium"
android:textColor="#color/home_profile_image_ellipse"
android:textSize="#dimen/text_small_normal" />
<TextView
android:id="#+id/textEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_mini_small"
android:textColor="#color/home_profile_image_ellipse"
android:textSize="#dimen/text_micro_mini" />
</LinearLayout>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/margin_small">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<Button
android:id="#+id/buttonMenuHome"
style="#style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_menu_home"
android:drawableStart="#drawable/ic_menu_home"
android:text="#string/menu_home" />
<Button
android:id="#+id/buttonMenuProfile"
style="#style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_menu_profile"
android:drawableStart="#drawable/ic_menu_profile"
android:text="#string/menu_profile" />
<Button
android:id="#+id/buttonMenuBasket"
style="#style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_menu_basket"
android:drawableStart="#drawable/ic_menu_basket"
android:text="#string/menu_basket" />
<Button
android:id="#+id/buttonMenuWishList"
style="#style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_menu_wish_list"
android:drawableStart="#drawable/ic_menu_wish_list"
android:text="#string/menu_wish_list" />
<Button
android:id="#+id/buttonMenuWhereToBay"
style="#style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_where_to_bay"
android:drawableStart="#drawable/ic_where_to_bay"
android:text="#string/menu_where_to_buy" />
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/home_menu_separator_line" />
<Button
android:id="#+id/buttonMenuSettings"
style="#style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_menu_settings"
android:drawableStart="#drawable/ic_menu_settings"
android:text="#string/menu_settings" />
<Button
android:id="#+id/buttonMenuCallCenter"
style="#style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_call_center"
android:drawableStart="#drawable/ic_call_center"
android:text="#string/menu_call_centar" />
<Button
android:id="#+id/buttonMenuAboutUs"
style="#style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_about_us"
android:drawableStart="#drawable/ic_about_us"
android:text="#string/menu_about_us" />
<Button
android:id="#+id/buttonMenuTerms"
style="#style/ButtonHomeMenuBorderlessWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_terms"
android:drawableStart="#drawable/ic_terms"
android:text="#string/menu_terms" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</android.support.design.widget.NavigationView>
When I try this content in AppBarLayout is showed how much is screen height. When I set DrawerLayout android:layout_height="wrap_content" it does not work. How to resolve this.
Thanks.
You would want the closing tag </android.support.design.widget.AppBarLayout> after the include toolbar and not where you have it after a linear layout. The way you have it is including most of what you define here in your AppBarLayout instead of below it, which is not what I think you are try to do.