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.
Related
I want to scroll tollbar while scrolling fragment in drawer layout.
Below is my xml layouts:
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<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">
<data></data>
<androidx.drawerlayout.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimary"
android:elevation="0dp"
android:keepScreenOn="true"
app:elevation="0dp"
tools:context=".ui.activities.CulpabilityHome">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/llOutertwo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_70sdp"
android:layout_marginBottom="#dimen/_70sdp"
android:background="#color/red"
android:orientation="horizontal"
android:visibility="visible" />
<LinearLayout
android:id="#+id/llOuterone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="#dimen/_10sdp"
android:layout_marginTop="#dimen/_40sdp"
android:layout_marginBottom="#dimen/_40sdp"
android:background="#color/black"
android:orientation="horizontal"
android:visibility="visible" />
<LinearLayout
android:id="#+id/llToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/gray_bg"
android:orientation="vertical">
<include
android:id="#+id/navHeader"
layout="#layout/layout_home_toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="#dimen/_1sdp"
android:background="#color/gray_bg" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="#dimen/_40sdp"
android:layout_gravity="bottom"
android:background="#color/white"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal">
<ImageView
android:id="#+id/home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_5sdp"
android:layout_marginEnd="#dimen/_5sdp"
android:layout_weight="0.25"
android:padding="#dimen/_10sdp"
android:src="#mipmap/home"
tools:ignore="RtlCompat" />
<ImageView
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_5sdp"
android:layout_weight="0.25"
android:padding="#dimen/_10sdp"
android:src="#mipmap/map"
tools:ignore="RtlCompat" />
<ImageView
android:id="#+id/myVideo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_5sdp"
android:layout_weight="0.25"
android:padding="#dimen/_10sdp"
android:src="#drawable/ic_my_video"
tools:ignore="RtlCompat" />
<!-- <ImageView-->
<!-- android:id="#+id/chat"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="#dimen/_5sdp"-->
<!-- android:layout_marginEnd="#dimen/_5sdp"-->
<!-- android:layout_weight="0.25"-->
<!-- android:padding="#dimen/_10sdp"-->
<!-- android:src="#mipmap/chats_icon"-->
<!-- tools:ignore="RtlCompat" />-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.25">
<ImageView
android:id="#+id/notification"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_5sdp"
android:layout_marginEnd="#dimen/_5sdp"
android:padding="#dimen/_10sdp"
android:src="#mipmap/notification"
tools:ignore="RtlCompat" />
<TextView
android:id="#+id/txtNotificationCountBadge"
android:layout_width="#dimen/_17sdp"
android:layout_height="#dimen/_17sdp"
android:layout_gravity="top"
android:layout_marginStart="50dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="-5dp"
android:background="#drawable/circle_notification_badge"
android:gravity="center"
android:text="99+"
android:textColor="#android:color/white"
android:textSize="9sp"
android:visibility="gone"
tools:visibility="visible" />
</FrameLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="#dimen/_1sdp"
android:background="#color/gray_bg" />
<FrameLayout
android:id="#+id/home_fram"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>
<com.google.android.material.navigation.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/colorPrimary"
android:fitsSystemWindows="true"
app:elevation="0dp"
app:headerLayout="#layout/nav_header_main"
app:itemBackground="#android:color/transparent"
app:itemIconTint="#color/white"
app:itemTextColor="#color/white"
app:itemVerticalPadding="#dimen/_12sdp"
app:menu="#menu/activity_main_drawer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical"
android:padding="#dimen/_16sdp">
<TextView
android:id="#+id/txtVersion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/gt_walsheim_pro_light"
android:gravity="start"
android:text="#string/app_version"
android:textColor="#color/white"
android:textSize="#dimen/_10sdp" />
</LinearLayout>
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>
</layout>
layout_home_toolbar.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">
<androidx.appcompat.widget.Toolbar
android:id="#+id/mainTool"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="#color/white"
android:contentInsetStart="0dp"
android:contentInsetLeft="0dp"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/HeaderToolLogo"
android:layout_width="#dimen/_32sdp"
android:layout_height="#dimen/_32sdp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="#dimen/_10sdp"
android:src="#mipmap/culpa_header_icon"
app:civ_border_color="#color/colorPrimary"
app:civ_border_width="#dimen/_1sdp" />
<TextView
android:id="#+id/HeaderToolText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="#font/gt_walsheim_pro_medium"
android:text="#string/home"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/_15ssp" />
<ImageView
android:id="#+id/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="#dimen/_5sdp"
android:layout_toStartOf="#+id/chat"
android:padding="#dimen/_5sdp"
android:src="#mipmap/search_home"
app:tint="#color/colorPrimary"
tools:ignore="RtlCompat" />
<ImageView
android:id="#+id/chat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="#dimen/_5sdp"
android:layout_marginEnd="#dimen/_5sdp"
android:layout_weight="0.25"
android:padding="#dimen/_5sdp"
android:src="#mipmap/chats_icon"
app:tint="#color/colorPrimary"
tools:ignore="RtlCompat" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
</LinearLayout>
I want to make toolbar hide while user scroll content like facebook.
I also tried to Appbarlayout but its not working so please help me to solve this issue.
Thanks in advance
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>
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"/>
I am trying to implement pull to refresh on CoordinatorLayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearMain"
android:layout_width="match_parent"
android:layout_height="990dp"
android:orientation="vertical">
<android.support.v4.widget.DrawerLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/contentView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<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="wrap_content"/>
</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.v4.widget.SwipeRefreshLayout>
<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">
<rs.netlink.android.widgets.MyButton
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"
app:font="#string/font_bold"/>
<rs.netlink.android.widgets.MyButton
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"
app:font="#string/font_bold"/>
<rs.netlink.android.widgets.MyButton
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"
app:font="#string/font_bold"/>
<rs.netlink.android.widgets.MyButton
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"
app:font="#string/font_bold"/>
<rs.netlink.android.widgets.MyButton
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"
app:font="#string/font_bold"/>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/home_menu_separator_line" />
<rs.netlink.android.widgets.MyButton
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"
app:font="#string/font_bold"/>
<rs.netlink.android.widgets.MyButton
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"
app:font="#string/font_bold"/>
<rs.netlink.android.widgets.MyButton
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"
app:font="#string/font_bold"/>
<rs.netlink.android.widgets.MyButton
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"
app:font="#string/font_bold"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
and it trigger refresh but then when I try to refresh viewpager
categories = categoryList;
TabsPagerAdapter tabsPager = new
TabsPagerAdapter(getSupportFragmentManager(), categories);
viewPagerCategories.setAdapter(tabsPager);
tableLayout.setupWithViewPager(viewPagerCategories);
viewPagerCategories.addOnPageChangeListener(this);
scroll in AppBarLayout don't work. I can't scroll to bottom anymore.
Can someone help me. Thanks.
You can try the repo nestrefresh. Replace AppBarLayout with RefreshBarLayout in lib. And add scroll behavior for the viewpager.
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" />