Reputation: 1468
I am trying to achieve an effect like the landing page of Google Play store. What I believe is, the hierarchy is as follows -
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?
Upvotes: 7
Views: 3046
Reputation: 672
ViewPager
Hi,
I don't think you required to use Recyclerview, I suggest you please use View Pager to achieve the feature. It will solve your problem.
Upvotes: 0
Reputation: 145
If i understood your question correctly you got scrollview as parent and you have a child recyclerview with horizontal scroll/swipe whatever so simply do this on your recyclerview.
addOnItemTouchListener(new OnItemTouchListener() {
@Override
public boolean onInterceptTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN && recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_SETTLING){
recyclerView.stopScroll();
}
return false;
}
@Override
public void onTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent) {
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean b) {
}
});
If you got more then 1 recyclerview do the same with other recyclerviews. And if this helps don't forget to upvote
Upvotes: 0
Reputation: 53
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();
}
Upvotes: 1