0

Below is my xml file containing ScrollView but scroll is not working, also when I run my program RecyclerView(at bottom) items goes missing from the UI display which is displayed when ScrollView is removed.

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="10dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:background="#fff">

    <ImageView
        android:id="@+id/movie_image"
        android:layout_width="250px"
        android:layout_height="300px"
        android:layout_alignParentLeft="true"
        android:scaleType="centerCrop"
        android:src="@drawable/jellybean"/>

    <!-- title Label -->
    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/movie_image"
        android:paddingLeft="20dip"
        android:textColor="@color/black"
        android:text="Title "
        android:singleLine="true"
        android:ellipsize="end"
        android:textSize="18sp"
        android:textStyle="bold" />

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/popularity_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="20dp"
        android:paddingBottom="10dp"
        android:orientation="horizontal"
        android:layout_toRightOf="@+id/movie_image"
        android:layout_below="@+id/title">

        <!-- popularity label -->
        <ImageView
            android:id="@+id/star1"
            android:layout_width="45px"
            android:layout_height="45px"
            android:layout_toRightOf="@+id/popularity"
            android:src="@drawable/blank_star" />
        <ImageView
            android:id="@+id/star2"
            android:layout_width="45px"
            android:layout_height="45px"
            android:layout_toRightOf="@+id/star1"
            android:src="@drawable/blank_star"/>
        <ImageView
            android:id="@+id/star3"
            android:layout_width="45px"
            android:layout_height="45px"
            android:layout_toRightOf="@+id/star2"
            android:src="@drawable/blank_star"/>
        <ImageView
            android:id="@+id/star4"
            android:layout_width="45px"
            android:layout_height="45px"
            android:layout_toRightOf="@+id/star3"
            android:scaleType="centerCrop"
            android:src="@drawable/blank_star"/>
        <ImageView
            android:id="@+id/star5"
            android:layout_width="45px"
            android:layout_height="45px"
            android:layout_toRightOf="@+id/star4"
            android:src="@drawable/blank_star"/>

    </RelativeLayout>

    <!-- tagline label -->
    <TextView
        android:id="@+id/tagline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="tagline"
        android:paddingLeft="20dip"
        android:layout_toRightOf="@+id/movie_image"
        android:layout_below="@+id/popularity_list"
        android:textColor="@color/black" />

    <!-- release date label -->
    <TextView
        android:id="@+id/release_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="20dip"
        android:layout_toRightOf="@+id/movie_image"
        android:layout_below="@+id/tagline"
        android:text="date "
        android:textColor="@color/black" />

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/budget_group"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="20dip"
        android:orientation="horizontal"
        android:layout_toRightOf="@+id/movie_image"
        android:layout_below="@+id/release_date">

        <!-- Budget label -->
        <TextView
            android:id="@+id/budget_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Budget : "
            android:textColor="@color/black" />
        <TextView
            android:id="@+id/budget"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/budget_text"
            android:text="budget "
            android:textColor="@color/black" />
    </RelativeLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/revenue_group"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="20dip"
        android:orientation="horizontal"
        android:layout_toRightOf="@+id/movie_image"
        android:layout_below="@+id/budget_group">

        <!-- Revenue label -->
        <TextView
            android:id="@+id/revenue_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Revenue : "
            android:textColor="@color/black" />
        <TextView
            android:id="@+id/revenue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/revenue_text"
            android:text="revenue "
            android:textColor="@color/black" />
    </RelativeLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/status_group"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="20dip"
        android:orientation="horizontal"
        android:layout_toRightOf="@+id/movie_image"
        android:layout_below="@+id/revenue_group">

        <!-- Movie status label -->
        <TextView
            android:id="@+id/status_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Status : "
            android:textColor="@color/black" />
        <TextView
            android:id="@+id/status"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/status_text"
            android:text="status "
            android:textColor="@color/black" />
    </RelativeLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/Vote_count_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingTop="10dip"
        android:layout_below="@+id/movie_image">

        <!-- favourites label -->
        <ImageView
            android:id="@+id/favourites"
            android:layout_width="50px"
            android:layout_height="50px"
            android:scaleType="centerCrop"
            android:src="@drawable/blank_star"/>

        <TextView
            android:id="@+id/opening_brac"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/favourites"
            android:paddingLeft="10dip"
            android:text="("
            android:textColor="@color/black" />

        <!-- Vote average label -->
        <TextView
            android:id="@+id/votes_avg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/opening_brac"
            android:text="Votes_avg "
            android:paddingBottom="2dip"
            android:textColor="@color/black" />

        <TextView
            android:id="@+id/after_vote_avg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/votes_avg"
            android:text="/10)"
            android:textColor="@color/black" />

        <!-- Total vote counts label -->
        <TextView
            android:id="@+id/votes_count"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/after_vote_avg"
            android:layout_toRightOf="@+id/favourites"
            android:paddingLeft="10dip"
            android:text="count"
            android:textColor="@color/black" />

        <TextView
            android:id="@+id/closing"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/after_vote_avg"
            android:layout_toRightOf="@+id/votes_count"
            android:text=" users."
            android:textColor="@color/black" />

        <!-- Overview label -->
        <TextView
            android:id="@+id/overview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/closing"
            android:text="Overview"
            android:paddingTop="20dp"
            android:textColor="@color/black" />
    </RelativeLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/fav_watchlist_icons"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingTop="10dip"
        android:gravity="center"
        android:layout_below="@+id/Vote_count_list">

        <!-- My favourite icon and text group -->
        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/fav_group"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingTop="10dip">

            <ImageView
                android:id="@+id/fav_icon"
                android:layout_width="160px"
                android:layout_height="160px"
                android:scaleType="centerCrop"
                android:src="@drawable/favorite_disable_normal"/>

            <TextView
                android:id="@+id/fav_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/fav_icon"
                android:paddingRight="20dp"
                android:paddingTop="10dp"
                android:text="My Favourite"
                android:textColor="@color/black" />
        </RelativeLayout>

        <!-- My watchlist icon and text group -->
        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/watchlist_icons"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingTop="10dip"
            android:layout_toRightOf="@+id/fav_group">

            <ImageView
                android:id="@+id/watchlist_icon"
                android:layout_width="160px"
                android:layout_height="160px"
                android:scaleType="centerCrop"
                android:src="@drawable/watchlist_disable_normal"/>

            <TextView
                android:id="@+id/watchlist_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="20dp"
                android:paddingTop="10dp"
                android:text="My Watchlist"
                android:layout_below="@id/watchlist_icon"
                android:textColor="@color/black" />
        </RelativeLayout>

    </RelativeLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/poster_list"
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="15dip"
        android:layout_below="@+id/fav_watchlist_icons">

        <!--  Recycler View  -->
        <android.support.v7.widget.RecyclerView
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/recycler_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scrollbars="none" />

    </RelativeLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/trailor_list"
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="5dip"
        android:layout_below="@+id/poster_list">

        <!--  Recycler View for Video links -->
        <android.support.v7.widget.RecyclerView
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/recycler_view_trailers"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scrollbars="none" />

    </RelativeLayout>

    </RelativeLayout>

</ScrollView> 

I saw in other posts mentioning ScrollView should be wrapped over a single object which I have done but Its still not working.

PKumar31
  • 13
  • 7
  • Nice crazy layout, didnt read it all but looks like some textviews will overlap each other, anyway, having nested scrolls is always tricky, you should look at something like this: http://developer.android.com/intl/es/reference/android/support/v4/widget/NestedScrollView.html – Nanoc Apr 08 '16 at 08:59
  • 1
    recycler view themselves are scrolling components that's why they are misbehaving with scrollview – Vivek Mishra Apr 08 '16 at 09:01
  • Set for `ScrollView` : `android:layout_height="match_parent"` – Volodymyr Kulyk Apr 08 '16 at 09:18
  • @Nanoc, items are not overlapping, I can see them on my phone display, not sure about the last recyclerview as I can't see it because scroll is not working. – PKumar31 Apr 08 '16 at 09:40
  • @Vladimir, tried setting ScrollView : android:layout_height="match_parent" but still not working – PKumar31 Apr 08 '16 at 09:46
  • @PKumar31 you can not used ScrollView with ReclyarView you used the expandable scrollview. – Ricky Patel Apr 08 '16 at 09:50
  • @Vivek, Here RecylerView is programmed to show horizontally(its scroll is working fine), I need a to scroll vertically for having so many items to display, any solution for the same? – PKumar31 Apr 08 '16 at 09:52
  • @Ricky, Will it work if RecyclerView is replaced with ListView? But problem is to display a ListView in horizontal fashion. – PKumar31 Apr 08 '16 at 09:59
  • @PKumar31 it's also not worked on listview because both component have own scrollview so... try this one :: https://lab.getbase.com/nested-scrolling-with-coordinatorlayout-on-android/ – Ricky Patel Apr 08 '16 at 10:02

5 Answers5

0

Try the following-

  1. Make your all relative layouts a child of linear Layout(After some research found it to be the correct way).
  2. Give your ScrollView layout a minimum height (android:minHeight).

It should work.

codeyourstack
  • 341
  • 1
  • 2
  • 11
  • No luck, scroll is still not working and as soon as I add ScrollView to my xml, in the Android preview itself I can see Recycler view items goes missing. – PKumar31 Apr 08 '16 at 09:36
  • I can see that clearly in my layout. Try adding some items in layout. Sometimes studio doesn't render layout perfectly. Run the project on your device after adding items statically for testing. I faced the same prob long back and solved using above only. – codeyourstack Apr 08 '16 at 09:54
  • Have you tried with with RecyclerView as well, that seems to be the culprit, I had tried on phone as well. – PKumar31 Apr 08 '16 at 10:51
  • It should not be the culprit. Works fine with me. Shows recycle view even in layout. – codeyourstack Apr 08 '16 at 17:25
  • Can you please share your xml? – PKumar31 Apr 09 '16 at 03:14
  • Issue has got resolved now. It got resolved by adding android:minHeight to RecyclerView. – PKumar31 Apr 12 '16 at 02:47
  • Like I mentioned u can mark it as answer if u liked it. Thanks. – codeyourstack Apr 12 '16 at 18:19
0

Same problem i had. Actually the main problem is scrollview.

Note: Don't use scrollview as a parent. Just take scrollview inside parent layout i.e. LinearLayout or RelativeLayout.

Try something like this:

<?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"
        android:orientation="vertical"
        android:padding="10dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:background="#fff">

        <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

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

        <ImageView
            android:id="@+id/movie_image"
            android:layout_width="250px"
            android:layout_height="300px"
            android:layout_alignParentLeft="true"
            android:scaleType="centerCrop"
            android:src="@drawable/jellybean"/>

        <!-- title Label -->
        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/movie_image"
            android:paddingLeft="20dip"
            android:textColor="@color/black"
            android:text="Title "
            android:singleLine="true"
            android:ellipsize="end"
            android:textSize="18sp"
            android:textStyle="bold" />

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/popularity_list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="20dp"
            android:paddingBottom="10dp"
            android:orientation="horizontal"
            android:layout_toRightOf="@+id/movie_image"
            android:layout_below="@+id/title">

            <!-- popularity label -->
            <ImageView
                android:id="@+id/star1"
                android:layout_width="45px"
                android:layout_height="45px"
                android:layout_toRightOf="@+id/popularity"
                android:src="@drawable/blank_star" />
            <ImageView
                android:id="@+id/star2"
                android:layout_width="45px"
                android:layout_height="45px"
                android:layout_toRightOf="@+id/star1"
                android:src="@drawable/blank_star"/>
            <ImageView
                android:id="@+id/star3"
                android:layout_width="45px"
                android:layout_height="45px"
                android:layout_toRightOf="@+id/star2"
                android:src="@drawable/blank_star"/>
            <ImageView
                android:id="@+id/star4"
                android:layout_width="45px"
                android:layout_height="45px"
                android:layout_toRightOf="@+id/star3"
                android:scaleType="centerCrop"
                android:src="@drawable/blank_star"/>
            <ImageView
                android:id="@+id/star5"
                android:layout_width="45px"
                android:layout_height="45px"
                android:layout_toRightOf="@+id/star4"
                android:src="@drawable/blank_star"/>

        </RelativeLayout>

        <!-- tagline label -->
        <TextView
            android:id="@+id/tagline"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="tagline"
            android:paddingLeft="20dip"
            android:layout_toRightOf="@+id/movie_image"
            android:layout_below="@+id/popularity_list"
            android:textColor="@color/black" />

        <!-- release date label -->
        <TextView
            android:id="@+id/release_date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="20dip"
            android:layout_toRightOf="@+id/movie_image"
            android:layout_below="@+id/tagline"
            android:text="date "
            android:textColor="@color/black" />

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/budget_group"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="20dip"
            android:orientation="horizontal"
            android:layout_toRightOf="@+id/movie_image"
            android:layout_below="@+id/release_date">

            <!-- Budget label -->
            <TextView
                android:id="@+id/budget_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Budget : "
                android:textColor="@color/black" />
            <TextView
                android:id="@+id/budget"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/budget_text"
                android:text="budget "
                android:textColor="@color/black" />
        </RelativeLayout>

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/revenue_group"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="20dip"
            android:orientation="horizontal"
            android:layout_toRightOf="@+id/movie_image"
            android:layout_below="@+id/budget_group">

            <!-- Revenue label -->
            <TextView
                android:id="@+id/revenue_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Revenue : "
                android:textColor="@color/black" />
            <TextView
                android:id="@+id/revenue"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/revenue_text"
                android:text="revenue "
                android:textColor="@color/black" />
        </RelativeLayout>

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/status_group"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="20dip"
            android:orientation="horizontal"
            android:layout_toRightOf="@+id/movie_image"
            android:layout_below="@+id/revenue_group">

            <!-- Movie status label -->
            <TextView
                android:id="@+id/status_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Status : "
                android:textColor="@color/black" />
            <TextView
                android:id="@+id/status"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/status_text"
                android:text="status "
                android:textColor="@color/black" />
        </RelativeLayout>

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/Vote_count_list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="10dip"
            android:layout_below="@+id/movie_image">

            <!-- favourites label -->
            <ImageView
                android:id="@+id/favourites"
                android:layout_width="50px"
                android:layout_height="50px"
                android:scaleType="centerCrop"
                android:src="@drawable/blank_star"/>

            <TextView
                android:id="@+id/opening_brac"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/favourites"
                android:paddingLeft="10dip"
                android:text="("
                android:textColor="@color/black" />

            <!-- Vote average label -->
            <TextView
                android:id="@+id/votes_avg"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/opening_brac"
                android:text="Votes_avg "
                android:paddingBottom="2dip"
                android:textColor="@color/black" />

            <TextView
                android:id="@+id/after_vote_avg"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/votes_avg"
                android:text="/10)"
                android:textColor="@color/black" />

            <!-- Total vote counts label -->
            <TextView
                android:id="@+id/votes_count"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/after_vote_avg"
                android:layout_toRightOf="@+id/favourites"
                android:paddingLeft="10dip"
                android:text="count"
                android:textColor="@color/black" />

            <TextView
                android:id="@+id/closing"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/after_vote_avg"
                android:layout_toRightOf="@+id/votes_count"
                android:text=" users."
                android:textColor="@color/black" />

            <!-- Overview label -->
            <TextView
                android:id="@+id/overview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/closing"
                android:text="Overview"
                android:paddingTop="20dp"
                android:textColor="@color/black" />
        </RelativeLayout>

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/fav_watchlist_icons"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="10dip"
            android:gravity="center"
            android:layout_below="@+id/Vote_count_list">

            <!-- My favourite icon and text group -->
            <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/fav_group"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingTop="10dip">

                <ImageView
                    android:id="@+id/fav_icon"
                    android:layout_width="160px"
                    android:layout_height="160px"
                    android:scaleType="centerCrop"
                    android:src="@drawable/favorite_disable_normal"/>

                <TextView
                    android:id="@+id/fav_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/fav_icon"
                    android:paddingRight="20dp"
                    android:paddingTop="10dp"
                    android:text="My Favourite"
                    android:textColor="@color/black" />
            </RelativeLayout>

            <!-- My watchlist icon and text group -->
            <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/watchlist_icons"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingTop="10dip"
                android:layout_toRightOf="@+id/fav_group">

                <ImageView
                    android:id="@+id/watchlist_icon"
                    android:layout_width="160px"
                    android:layout_height="160px"
                    android:scaleType="centerCrop"
                    android:src="@drawable/watchlist_disable_normal"/>

                <TextView
                    android:id="@+id/watchlist_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingRight="20dp"
                    android:paddingTop="10dp"
                    android:text="My Watchlist"
                    android:layout_below="@id/watchlist_icon"
                    android:textColor="@color/black" />
            </RelativeLayout>

        </RelativeLayout>

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/poster_list"
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="15dip"
            android:layout_below="@+id/fav_watchlist_icons">

            <!--  Recycler View  -->
            <android.support.v7.widget.RecyclerView
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/recycler_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scrollbars="none" />

        </RelativeLayout>

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/trailor_list"
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="5dip"
            android:layout_below="@+id/poster_list">

            <!--  Recycler View for Video links -->
            <android.support.v7.widget.RecyclerView
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/recycler_view_trailers"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scrollbars="none" />

        </RelativeLayout>
            </RelativeLayout>
        </ScrollView>
    </RelativeLayout>
Däñish Shärmà
  • 2,891
  • 2
  • 25
  • 43
0

ScrollView can have only one child or ViewGroup.

In your layout you have 2 relative layout child's.So merge both as one ViewGruop.

Set width and height of your ScrollView to fill_parent

Raghavendra B
  • 441
  • 3
  • 10
0

Use android:fillViewPort:true in Scrollview

  • Tried this, now RecyclerView is also getting displayed but Scroll is still not working(earlier RecyclerView went missing when ScrollView was added to the activity). – PKumar31 Apr 09 '16 at 02:53
  • take one vertical linear layout between scroll view tag......all all those relative layout code between linear layout tag....hope it will work.....you have to do this because scrollview can have only one child layout ....but in ur case you have two child relative layout – lokeshdesai403 Apr 09 '16 at 11:54
  • Tried this as well, putting all relative layouts under one LinearLayout and put Scroll View on top of that but that also did not work...btw in my xml posted above, RelativeLayout mentioned on top ends only at the bottom hence making it a single single object for Scroll View. – PKumar31 Apr 10 '16 at 05:12
0

You can use android:fillViewport="true" to make NestedScrollView measure the RecyclerView. The RecyclerView will fill the remaining height. so if you want to scroll the NestScrollView, you can set the RecyclerView's minHeight.

Please refer to below link: How to use RecyclerView inside NestedScrollView?

Community
  • 1
  • 1
PKumar31
  • 13
  • 7