Grid view scrolling is not working in android - android

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

Related

How to half overlap frameLyout in android coordinate layout

I want to design a layout like this:
I have use from AppBarLayout and I tried this code:
<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:layout_marginTop="-200dp">-->
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="#android:color/transparent"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/banner_detail_course_img"
android:visibility="visible">
<!--<ImageView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:src="#drawable/banner_detail_course_img"-->
<!--android:scaleType="centerCrop"/>-->
<TextView
android:id="#+id/header_txtTitleCourse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="60dp"
android:layout_marginEnd="10dp"
android:text="#{courseItem.title}"
android:textColor="#fff"
android:textSize="30sp" />
<TextView
android:id="#+id/header_txtShortDescCourse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtTitleCourse"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:text="#{courseItem.shortDescription}"
android:textColor="#fff"
android:textSize="15sp" />
<TextView
android:id="#+id/header_txtRate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtShortDescCourse"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="#drawable/rounded_background_textview"
android:drawableEnd="#drawable/ic_star"
android:drawablePadding="5dp"
android:text="#{String.valueOf(courseItem.ratingAvg)}"
android:textColor="#fff"
android:textSize="15sp" />
<TextView
android:id="#+id/header_txtEnrolled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtShortDescCourse"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_toStartOf="#+id/header_txtRate"
android:background="#drawable/rounded_background_textview"
android:drawableEnd="#drawable/ic_user_enrolled"
android:drawablePadding="5dp"
android:text="#{courseItem.numberEnroll.concat(#string/space).concat(#string/number_enroll)}"
android:textColor="#fff"
android:textSize="15sp" />
<TextView
android:id="#+id/header_txtDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtRate"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="#drawable/rounded_background_textview"
android:drawableEnd="#drawable/ic_play_icon"
android:drawablePadding="5dp"
android:text="#{courseItem.duration.concat(#string/space).concat(#string/label_hour)}"
android:textColor="#fff"
android:textSize="15sp" />
<TextView
android:id="#+id/header_txtInstructor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtRate"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_toStartOf="#+id/header_txtDuration"
android:background="#drawable/rounded_background_textview"
android:text="#{#string/txt_label_instructor.concat(#string/space).concat(courseItem.instructorName)}"
android:textColor="#fff"
android:textSize="15sp" />
<TextView
android:id="#+id/header_txtUpdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtInstructor"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="#drawable/rounded_background_textview"
android:text="#{#string/last_update_course.concat(#string/space).concat(courseItem.updateDate)}"
android:textColor="#FFF"
android:textSize="15sp" />
<FrameLayout
android:id="#+id/flPreview"
android:layout_width="260dp"
android:layout_height="220dp"
android:layout_below="#+id/header_txtUpdate"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp">
<ImageView
android:id="#+id/imgPreview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/preview_video_view"
app:imageUrl="#{courseItem.imagePreview}" />
<ImageView
android:id="#+id/imgPlayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/ic_play_video" />
<TextView
android:id="#+id/header_txtPreview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="20dp"
android:text="#string/txt_show_preview_video"
android:textColor="#FFF"
android:textSize="20sp"
android:textStyle="bold" />
</FrameLayout>
</RelativeLayout>
<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/ThemeOverlay.AppCompat.Light">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imgBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:src="#drawable/ic_back_press" />
<ImageView
android:id="#+id/imgFavorit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="#+id/imgShare"
android:src="#drawable/ic_favorite_toolbar" />
<ImageView
android:id="#+id/imgShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:src="#drawable/ic_share" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/txtCurrentPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="30dp"
android:layout_marginEnd="20dp"
android:text="#{courseItem.price}"
android:textSize="30sp"
android:textStyle="bold" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
And my output layout is :
I want to be half of FrameLayout preview with id flPreview in the AppBarLayout.
please check this code. this may help you
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="500dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimary"
android:layout_marginBottom="100dp"> <!--just set the half of the size of the frame layout-->
<!--your content here-->
</RelativeLayout>
<FrameLayout
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:background="#color/colorPrimaryDark">
<!--your frame layout content here-->
</FrameLayout>
</RelativeLayout>
</RelativeLayout>
try this on your 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:layout_marginTop="-200dp">-->
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="500dp"
android:background="#fff"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="#android:color/transparent"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<!--<ImageView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:src="#drawable/banner_detail_course_img"-->
<!--android:scaleType="centerCrop"/>-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimaryDark"
android:layout_marginBottom="110dp">
<!-- android:background="#drawable/banner_detail_course_img"-->
<TextView
android:id="#+id/header_txtTitleCourse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="60dp"
android:layout_marginEnd="10dp"
android:text="courseItem.title"
android:textColor="#fff"
android:textSize="30sp" />
<TextView
android:id="#+id/header_txtShortDescCourse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtTitleCourse"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:text="courseItem.shortDescription"
android:textColor="#fff"
android:textSize="15sp" />
<TextView
android:id="#+id/header_txtRate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtShortDescCourse"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:drawablePadding="5dp"
android:text="courseItem ratingAvg"
android:textColor="#fff"
android:textSize="15sp" />
<!--android:drawableEnd="#drawable/ic_star"
android:background="#drawable/rounded_background_textview"-->
<TextView
android:id="#+id/header_txtEnrolled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtShortDescCourse"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_toStartOf="#+id/header_txtRate"
android:drawablePadding="5dp"
android:text="#{courseItem.numberEnroll.concat(#string/space).concat(#string/number_enroll)}"
android:textColor="#fff"
android:textSize="15sp" />
<!--android:background="#drawable/rounded_background_textview"
android:drawableEnd="#drawable/ic_user_enrolled"-->
<TextView
android:id="#+id/header_txtDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtRate"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:drawablePadding="5dp"
android:text="#{courseItem.duration.concat(#string/space).concat(#string/label_hour)}"
android:textColor="#fff"
android:textSize="15sp" />
<!-- android:background="#drawable/rounded_background_textview"
android:drawableEnd="#drawable/ic_play_icon"-->
<TextView
android:id="#+id/header_txtInstructor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtRate"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_toStartOf="#+id/header_txtDuration"
android:text="#{#string/txt_label_instructor.concat(#string/space).concat(courseItem.instructorName)}"
android:textColor="#fff"
android:textSize="15sp" />
<!-- android:background="#drawable/rounded_background_textview"-->
<TextView
android:id="#+id/header_txtUpdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header_txtInstructor"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:text="#{#string/last_update_course.concat(#string/space).concat(courseItem.updateDate)}"
android:textColor="#FFF"
android:textSize="15sp" />
<!-- android:background="#drawable/rounded_background_textview"-->
</RelativeLayout>
<FrameLayout
android:id="#+id/flPreview"
android:layout_width="260dp"
android:layout_height="220dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="#color/colorPrimary"
android:layout_marginTop="20dp">
<ImageView
android:id="#+id/imgPreview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
/>
<!-- android:src="#drawable/preview_video_view"-->
<ImageView
android:id="#+id/imgPlayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#color/colorPrimary"
/>
<!-- android:src="#drawable/ic_play_video"-->
<TextView
android:id="#+id/header_txtPreview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="20dp"
android:text="txt_show_preview_video"
android:textColor="#FFF"
android:textSize="20sp"
android:textStyle="bold" />
</FrameLayout>
</RelativeLayout>
<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/ThemeOverlay.AppCompat.Light">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imgBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
/>
<!-- android:src="#drawable/ic_back_press"-->
<ImageView
android:id="#+id/imgFavorit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_toEndOf="#+id/imgShare"
/>
<!--android:src="#drawable/ic_favorite_toolbar"-->
<ImageView
android:id="#+id/imgShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
/>
<!-- android:src="#drawable/ic_share"-->
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/txtCurrentPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="30dp"
android:layout_marginEnd="20dp"
android:text="#{courseItem.price}"
android:textSize="30sp"
android:textStyle="bold" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
just change the values and images according to your project

Can't see NavigationView

I have this layout and I want to see the navigationView. There's no error in my xml and I can't figure out where the problem is. Here is the .xml file. What is not working is at the end of the file.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.andre.nutridian.Home"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorPrimary"
android:elevation="4dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</FrameLayout>
<TextView
android:layout_width="359dp"
android:layout_height="50dp"
android:singleLine="true"
android:text="MENIU"
android:textAlignment="center"
android:textAppearance="#android:style/TextAppearance.Material.Medium"
android:textColor="#color/colorPrimary"
android:textSize="24sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:gravity="center"
android:orientation="horizontal">
<android.support.v7.widget.CardView
android:id="#+id/tabel"
android:layout_width="160dp"
android:layout_height="190dp"
android:layout_margin="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:background="#drawable/cerclebackgroundpurple"
android:padding="10dp"
android:src="#drawable/ic_accessibility_black_24dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Banking"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#color/lightgray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:text="Raport"
android:textColor="#android:color/darker_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/dieta"
android:layout_width="160dp"
android:layout_height="190dp"
android:layout_margin="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:background="#drawable/cerclebackgroundpink"
android:padding="10dp"
android:src="#drawable/ic_pie_chart_outlined_black_24dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Ideas"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#color/lightgray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:text="Diete"
android:textColor="#android:color/darker_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:gravity="center"
android:orientation="horizontal">
<android.support.v7.widget.CardView
android:id="#+id/calcul"
android:layout_width="160dp"
android:layout_height="190dp"
android:layout_margin="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:background="#drawable/cerclebackgroundgreen"
android:padding="10dp"
android:src="#drawable/ic_today_black_24dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Add"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#color/lightgray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:text="Liste alimente calorii"
android:textColor="#android:color/darker_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/statistici"
android:layout_width="160dp"
android:layout_height="190dp"
android:layout_margin="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:background="#drawable/cerclebackgroundyello"
android:padding="10dp"
android:src="#drawable/ic_trending_up_black_24dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Ideas"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#color/lightgray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:text="Statistici"
android:textColor="#android:color/darker_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="#layout/nav_header">
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
The app doesn't see the the NavigationView widget. When I run the app, the navigationDrawer works, but it does not display the items. What should I do? What should I modify? Please help me with this problem. Thank you

How to add CardView to a Navigation Drawer Activity?

I have been trying to add CardView to navigationDrawer activity and collapsing toolbar layout all in one activity so that I can view all my contents form navigation drawer and collapse the layout and use card view as my buttons to make it more attractive. but it works fine as long as I don't add card views into the layout, but when I add the CardView into the code that is XML file and run the program the emulator shows that the app has not responding.
I need help with this, please anyone.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.madhu.management.DashBoard">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e0e0e0">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="250dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsingtoolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/materialappbar"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="480dp"
app:layout_scrollFlags="exitUntilCollapsed|scroll"
app:title="management">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbarid"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="#+id/ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fcfcfc"
android:gravity="center"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:gravity="center"
android:orientation="horizontal">
<android.support.v7.widget.CardView
android:id="#+id/bankcardId"
android:layout_width="160dp"
android:layout_height="190dp"
android:layout_margin="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:background="#drawable/circlebackgroundpurple"
android:padding="10dp"
android:src="#drawable/ic_add_alert_white_24px" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Notice"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#color/lightgray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:text="department notice board"
android:textColor="#android:color/darker_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="190dp"
android:layout_margin="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:background="#drawable/circlebackgroundpink"
android:padding="10dp"
android:src="#drawable/ic_book_white_24px" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Notes"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#color/lightgray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:text="Notes from faculty"
android:textColor="#android:color/darker_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:gravity="center"
android:orientation="horizontal">
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="190dp"
android:layout_margin="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:background="#drawable/circlebackgroundgreen"
android:padding="10dp"
android:src="#drawable/ic_help_outline_white_24px" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Question papers"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#color/lightgray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:text="Question banks and question papers"
android:textColor="#android:color/darker_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="190dp"
android:layout_margin="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:background="#drawable/circlebackgroundyellow"
android:padding="10dp"
android:src="#drawable/ic_update_white_24px" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="University Updates"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#color/lightgray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:text="updates from university"
android:textColor="#android:color/darker_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:gravity="center"
android:orientation="horizontal">
<android.support.v7.widget.CardView
android:layout_width="340dp"
android:layout_height="150dp"
android:layout_margin="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:background="#drawable/circlebackgroundpurple"
android:padding="10dp"
android:src="#drawable/ic_stars_white_24dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Results"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#color/lightgray" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dp"
android:text="semister results"
android:textColor="#android:color/darker_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffffff"
app:headerLayout="#layout/header"
app:itemIconTint="#color/colorPrimaryDark"
app:itemTextColor="#color/colorPrimaryDark"
app:menu="#menu/drawermenu" />
</android.support.v4.widget.DrawerLayout>

NestedScrollView is not working with viewpager in android

In my activity I am using Tablayout bellow 300dp from the top is set. in Tablayout I have 3 fragments, the problem is it's showing the fragments but my layout is not scrolling up. I tried Scrollview and NesterScrollview, but none of them worked. please see my xml code below
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.widget.NestedScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="260dp"
android:background="#fff">
<!-- Cover Image -->
<ImageView
android:id="#+id/bgimage"
android:layout_width="match_parent"
android:layout_height="180dp"
android:scaleType="fitXY"
android:src="#drawable/profilebg" />
<!-- Round image -->
<ImageView
android:id="#+id/shareicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:tint="#color/black"
android:layout_gravity="bottom"
android:padding="5dp"
android:background="#drawable/imageborder"
android:src="#drawable/share"/>
<android.support.v7.widget.CardView
android:layout_width="140dp"
android:layout_height="140dp"
android:elevation="12dp"
android:id="#+id/view2"
app:cardCornerRadius="100dp"
android:layout_centerHorizontal="true"
android:innerRadius="0dp"
android:shape="ring"
android:layout_gravity="center"
android:layout_marginTop="60dp"
android:thicknessRatio="1.9">
<ImageView
android:id="#+id/profilepic"
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_gravity="center"/>
</android.support.v7.widget.CardView>
<ImageView
android:id="#+id/editic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:tint="#color/black"
android:layout_marginRight="40dp"
android:background="#drawable/imageborder"
android:padding="6dp"
android:src="#drawable/ic_pencil"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#fff">
<zesteve.com.myapplication.font.RobotoTextView
android:id="#+id/usertitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tom Cruise"
android:textSize="22dp"
android:textColor="#color/black"
android:layout_gravity="center"/>
<zesteve.com.myapplication.font.RobotoTextView
android:id="#+id/userlocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Syracuse, New York"
android:layout_gravity="center"
android:textColor="#color/black"
android:textSize="14dp"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="#color/material_purple_500"
android:layout_marginTop="25dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:gravity="center"
android:layout_marginTop="5dp">
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="256"
android:textColor="#color/black"
android:textStyle="bold"
android:textSize="16dp" />
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="LIKES"
android:textSize="12sp"/>
</LinearLayout>
<View
android:layout_width="0.1dp"
android:layout_height="50dp"
android:background="#color/material_purple_500"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:gravity="center"
android:layout_marginTop="5dp"
>
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2,080"
android:textColor="#color/black"
android:textStyle="bold"
android:textSize="16dp" />
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="FOLLOWERS"
android:textSize="12sp"/>
</LinearLayout>
<View
android:layout_width="0.1dp"
android:layout_height="50dp"
android:background="#color/material_purple_500"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:gravity="center"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp">
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="144"
android:textColor="#color/black"
android:textStyle="bold"
android:textSize="16dp" />
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="FOLLOWING"
android:textSize="12sp"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="#color/material_purple_500" />
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="40dp"
app:tabGravity="fill"
app:tabMode="fixed"
style="#style/NavigationTab"
android:background="?attr/colorPrimary"/>
<android.support.v4.view.ViewPager
android:id="#+id/ptab_viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
I also tried below
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="260dp"
android:background="#fff">
<!-- Cover Image -->
<ImageView
android:id="#+id/bgimage"
android:layout_width="match_parent"
android:layout_height="180dp"
android:scaleType="fitXY"
android:src="#drawable/profilebg" />
<!-- Round image -->
<ImageView
android:id="#+id/shareicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:tint="#color/black"
android:layout_gravity="bottom"
android:padding="5dp"
android:background="#drawable/imageborder"
android:src="#drawable/share"/>
<android.support.v7.widget.CardView
android:layout_width="140dp"
android:layout_height="140dp"
android:elevation="12dp"
android:id="#+id/view2"
app:cardCornerRadius="100dp"
android:layout_centerHorizontal="true"
android:innerRadius="0dp"
android:shape="ring"
android:layout_gravity="center"
android:layout_marginTop="60dp"
android:thicknessRatio="1.9">
<ImageView
android:id="#+id/profilepic"
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_gravity="center"/>
</android.support.v7.widget.CardView>
<ImageView
android:id="#+id/editic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:tint="#color/black"
android:layout_marginRight="40dp"
android:background="#drawable/imageborder"
android:padding="6dp"
android:src="#drawable/ic_pencil"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#fff">
<zesteve.com.myapplication.font.RobotoTextView
android:id="#+id/usertitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tom Cruise"
android:textSize="22dp"
android:textColor="#color/black"
android:layout_gravity="center"/>
<zesteve.com.myapplication.font.RobotoTextView
android:id="#+id/userlocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Syracuse, New York"
android:layout_gravity="center"
android:textColor="#color/black"
android:textSize="14dp"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="#color/material_purple_500"
android:layout_marginTop="25dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:gravity="center"
android:layout_marginTop="5dp">
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="256"
android:textColor="#color/black"
android:textStyle="bold"
android:textSize="16dp" />
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="LIKES"
android:textSize="12sp"/>
</LinearLayout>
<View
android:layout_width="0.1dp"
android:layout_height="50dp"
android:background="#color/material_purple_500"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:gravity="center"
android:layout_marginTop="5dp"
>
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2,080"
android:textColor="#color/black"
android:textStyle="bold"
android:textSize="16dp" />
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="FOLLOWERS"
android:textSize="12sp"/>
</LinearLayout>
<View
android:layout_width="0.1dp"
android:layout_height="50dp"
android:background="#color/material_purple_500"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:gravity="center"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp">
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="144"
android:textColor="#color/black"
android:textStyle="bold"
android:textSize="16dp" />
<zesteve.com.myapplication.font.RobotoTextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="FOLLOWING"
android:textSize="12sp"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="#color/material_purple_500" />
<include layout="#layout/profile_tab_layout"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
and included layout is
<?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="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">
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="40dp"
app:tabGravity="fill"
app:tabMode="fixed"
style="#style/NavigationTab"
android:background="?attr/colorPrimary"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/ptab_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
IMAGE
this result is second approach using include. its showing tab's and fragments also, but if we scroll top rest of the content will show.

NestedScrollView doesnt show cards with wrap content and dynamic data

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

Categories

Resources