Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] android – Two recycler view inside a scroll view

Posted on November 14, 2022

Solution 1 :

I used a heterogeneous recycler view with three views. First is the scheduled events which are always on top, then the separator and then the recent event views. Read more about multiple views in a recycler view or heterogeneous recycler view.

Problem :

I can use nested scroll view to have two recycler view but issue with that is recycler view is no more recycler view as it inflates all the view at once and if I add a on scroll listener to any recycler view then you will see all items are visible at once.

Is there any way where I can achieve scrollability of both recycler view at once.

Use Case:

I need to show scheduled events on top of history of events. I just want that both behaves as one big recycler view maintained individually. I don’t mind showing all scheduled events before history of events.

 <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
    android_id="@+id/pullToRefresh"
    app_layout_constraintTop_toBottomOf="@+id/view_meetings_above_divider"
    app_layout_constraintBottom_toTopOf="@+id/inviteContactImage"
    android_layout_width="match_parent"
    app_layout_behavior="@string/appbar_scrolling_view_behavior"
    android_layout_height="0dp">
    <androidx.core.widget.NestedScrollView
        android_id="@+id/nestedScrollView"
        app_layout_behavior="@string/appbar_scrolling_view_behavior"
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_fillViewport="true"
        android_paddingBottom="@dimen/dp_30"
        >
        <LinearLayout android_orientation="vertical"
            android_layout_width="match_parent"
            android_layout_height="wrap_content">
            <androidx.recyclerview.widget.RecyclerView
                android_orientation="vertical"
                android_id="@+id/upcomingScheduledEvent"
                android_layout_width="match_parent"
                android_layout_height="wrap_content"
                />
            <View
                android_id="@+id/view_history_above_divider"
                android_layout_width="match_parent"
                android_layout_height="8dp"
                android_background="#EEEEEE"/>
            <androidx.recyclerview.widget.RecyclerView
                android_id="@+id/recentEvents"
                android_layout_width="match_parent"
                android_layout_height="wrap_content"
                android_orientation="vertical"
                android_visibility="visible"
                android_nestedScrollingEnabled="true"
                android_scrollbarStyle="outsideOverlay"
                android_scrollbars="vertical" />
            <LinearLayout
                android_id="@+id/noRecentEvents"
                android_layout_width="match_parent"
                android_layout_height="match_parent"
                android_gravity="center"
                android_orientation="vertical"
                android_layout_marginTop="@dimen/dp_10"
                android_visibility="gone">

                <TextView
                    android_layout_width="wrap_content"
                    android_layout_height="wrap_content"
                    android_layout_gravity="center"
                    android_layout_marginTop="@dimen/px_32"
                    android_text="@string/find_your_colleagues_and_friends_to_chat"
                    android_textColor="@color/black"
                    android_textSize="@dimen/dp_14" />

                <TextView
                    android_id="@+id/id_startSearch"
                    android_layout_width="125dp"
                    android_layout_height="36dp"
                    android_layout_marginTop="20dp"
                    android_background="@drawable/no_meeting_round_button_drawable"
                    android_gravity="center"
                    android_text="@string/chat_now"
                    android_textColor="@color/action_bar_color"
                    android_textSize="12sp" />
            </LinearLayout>
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

Comments

Comment posted by ZBorkala

Can you show your code, please? So that, we can help you somehow.

Comment posted by Tarun Chawla

Will share in a min.

Comment posted by Tarun Chawla

@ZBorkala please check.

Comment posted by ZBorkala

If you also provide a screenshot of the current result, that would be better.

READ  [ANSWERED] firebase - Flutter Cloud Firestore crash on Android - MutableDocument.getKey() on null object referene
Powered by Inline Related Posts

Comment posted by Tarun Chawla

Upcoming schedule event recylcer and recent view recycler are scrolling at once.

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress