0

This is the code :

    <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/grey_f2"
    android:fillViewport="true"
    >
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    >
    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/rv_achievement_badges"
        android:focusableInTouchMode="false"

        />
    <LinearLayout
        android:background="@color/white"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:padding="25dp"
        >
        <com.sharesmile.share.views.LBTextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/hall_of_fame"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:textColor="@color/black_64"
            android:textSize="20sp"
            />
        <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/rv_hall_of_fame"
            android:focusableInTouchMode="false"
            />
    </LinearLayout>
</LinearLayout>
</ScrollView>

The issue is rv_hall_of_fame does not show all items. tried nestedsrollview, viewport, canScrollVertically and setNestedScrollingEnabled and nothing is working. Can you let me know.

2 Answers 2

1

You should remove the second recyclerview from the linearlayout. Maybe that is the reason you can't see all items.

EDIT:

I think you should use NestedScrollView. I had the same problem in one of my projects and I changed my code to below which solved my problem.

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_f2"
android:fillViewport="true"
android:focusableInTouchMode="true">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rv_achievement_badges"/>

<com.sharesmile.share.views.LBTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hall_of_fame"
android:layout_marginTop="10dp"
android:textColor="@color/black_64"
android:textSize="20sp"
android:background="@color/white"
android:paddingLeft="25dp"
android:paddingTop="36dp"/>

<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rv_hall_of_fame"
android:background="@color/white"
android:layout_marginBottom="7dp"
android:paddingBottom="30dp"
android:paddingTop="30dp"
android:paddingLeft="25dp"
android:paddingRight="25dp"/>

</LinearLayout>

</android.support.v4.widget.NestedScrollView>
Sign up to request clarification or add additional context in comments.

2 Comments

@ParthAnjaria I have updated my answer, Please check.
Thanks, works like a charm. so simple and i wasted one day on it
0

It's not wise to put a RecyclerView or a ListView inside a ScrollView. Android doesn't know how to handle user events. In addition, in your case, you have two RecyclerView inside that root ScrollView... It's madness both for the Android UI framework and for the user.

A solution could be to only use one RecyclerView that handles the scroll user action, and an Adapter that knows how to render everything you use: achievements badges, the hall of fame label, and the players. So, you'll only need one RecyclerView, and it will work like a charm.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.