Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smooth Horizontal Scrolling of Recyclerview inside Scrollview

I am trying to achieve an effect like the landing page of Google Play store. What I believe is, the hierarchy is as follows -

  • CoordinatorLayout
  • ScrollView
  • Recyclerview with Horizontal Linearlayout

The Horizontal swipe on the "New+Updated Games" section is incredibly smooth, and does not interfere with vertical scrolling. In my implementation, during swipe, there is a movement up and down, and thus the effect is not smooth.

Ideally only for explicit UP or DOWN gestures, should the view go up or down.

Is my understanding correct? Is there any tutorial or guide that helps me achieve the same effect?

enter image description here

like image 392
Amit Pandey Avatar asked Dec 20 '15 18:12

Amit Pandey


People also ask

How do I prevent NestedScrollView from scrolling if body is small?

The problem can be solved by moving the SliverAppBar into the CustomScrollView and not use the NestedScrollView at all.

How do I stop NestedScrollView scrolling?

setnestedscrollingenabled set it to false. try this one add property in recyclerview android:descendantFocusability="blocksDescendants" .

What is nested scroll view?

NestedScrollView is just like ScrollView , but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.


1 Answers

I would really appreciate if you could add some code snippets for a better understanding of your problem.. Albeit, here's an excerpt

{
 recyclerView.setHasFixedSize(true);
        linearLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, true);
        linearLayoutManager.setReverseLayout(false);
        linearLayoutManager.setStackFromEnd(false);
        adapter = new RecyclerAdapter(getContext(), arrayList);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.setAdapter(adapter);
        recyclerView.setNestedScrollingEnabled(false);
        adapter.notifyDataSetChanged();
}
like image 146
Kanika Avatar answered Nov 22 '22 09:11

Kanika