1

Recycler view contents are not completely shown which is inside nested scroll view. I have gone through all possible solutions suggested but none turned out to be helpful. XML Layout is below:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/collapsingappbar"
        android:layout_width="match_parent"
        android:layout_height="385dp"
        android:background="@color/colorPrimary">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsingtool"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="@color/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <ImageView
                android:id="@+id/imageView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"
                app:layout_collapseMode="parallax" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:fitsSystemWindows="true"
                android:titleTextColor="@color/colorPrimary"
                app:layout_collapseMode="pin" />

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_vertical"
        android:layout_marginLeft="8dp"
        android:fillViewport="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/toolbar"
            android:orientation="vertical">

            <TextView
                android:id="@+id/movietitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="@string/name"
                android:textColor="@color/detailstextcolor"
                android:textSize="18sp" />

            <TextView
                android:id="@+id/moviename"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:textColor="@color/detailstextcolor"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/movieoverviews"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="@string/overview"
                android:textColor="@color/detailstextcolor"
                android:textSize="18sp" />

            <TextView
                android:id="@+id/movieoverview"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:textColor="@color/detailstextcolor"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/moviedate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="@string/date"
                android:textColor="@color/detailstextcolor"
                android:textSize="18sp" />

            <TextView
                android:id="@+id/movierelease"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:textColor="@color/detailstextcolor"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/movievotes"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="@string/votes"
                android:textColor="@color/detailstextcolor"
                android:textSize="18sp" />

            <TextView
                android:id="@+id/movievote"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:textColor="@color/detailstextcolor"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/movieratings"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:text="@string/rating"
                android:textColor="@color/detailstextcolor"
                android:textSize="18sp" />

            <TextView
                android:id="@+id/movierating"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:textColor="@color/detailstextcolor"
                android:textSize="14sp" />

            <View
                android:id="@+id/seperator"
                android:layout_width="wrap_content"
                android:layout_height="1dp"
                android:background="@color/detailstextcolor" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:gravity="center"
                android:text="@string/titlevideos"
                android:textColor="@color/detailstextcolor"
                android:textSize="14sp" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/videos"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="5dp"
                android:layout_marginTop="5dp"
                app:layout_behavior="@string/appbar_scrolling_view_behavior" />

        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout></RelativeLayout>

Populating with grid layout manager. I tired to set nested scrolling false. But it didn't work either.

RecyclerView.LayoutManager layoutManager = new GridLayoutManager(this,2);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setNestedScrollingEnabled(false);

Layout which uses recycler view.

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:card_view="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_marginTop="8dp"
  android:orientation="vertical">

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:layout_margin="4dp"
    android:elevation="4dp"
    card_view:cardCornerRadius="4dp">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center">

        <ImageView
            android:id="@+id/thumbnail"
            android:layout_width="match_parent"
            android:layout_height="160dp"
            android:clickable="true"
            android:foregroundGravity="center" />

        <TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/thumbnail"
            android:layout_gravity="center"
            android:layout_marginTop="5dp"
            android:textColor="@color/detailstextcolor" />
    </RelativeLayout>
</android.support.v7.widget.CardView> </LinearLayout>`

Recycler view size changes dynamically which is fetched from an API. If size is say for eg.4, then last 2 card views bottom half are cut off from screen and if size is 5, then last one view is cut off.

Support library used is v24. Anything I am missing here?

Sriram S
  • 169
  • 14

0 Answers0