Disable Scrolling in child Recyclerview android

I finally found a solution. Create Custom LinearLayoutManager public class CustomLinearLayoutManager extends LinearLayoutManager { public CustomLinearLayoutManager(Context context, int orientation, boolean reverseLayout) { super(context, orientation, reverseLayout); } // it will always pass false to RecyclerView when calling “canScrollVertically()” method. @Override public boolean canScrollVertically() { return false; } } Then instantiate it like this for vertical scrolling … Read more

How to achieve a staggered grid layout using Jetpack compose?

One of Google’s Compose sample Owl shows how to do a staggered grid layout. This is the code snippet that is used to compose this: @Composable fun StaggeredVerticalGrid( modifier: Modifier = Modifier, maxColumnWidth: Dp, children: @Composable () -> Unit ) { Layout( children = children, modifier = modifier ) { measurables, constraints -> check(constraints.hasBoundedWidth) { … Read more

Recycler view – resizing item view while scrolling (for carousel like effect)

I found this answer on SO, which did the exact same thing horizontally. Answer provides a working solution that extends LinearLayoutManager. I modified it a bit for also adapting vertical lists and it works. If there is any mistake in implementation, let me know in comments. Cheers! Custom Layout Manager : public class CenterZoomLayoutManager extends … Read more

Android – the item inside RecyclerView can’t be clicked after scroll

Found a way to force the scroll state to be idle. Waiting for google to fix this bug. @Override public boolean onInterceptTouchEvent(MotionEvent event) { boolean requestCancelDisallowInterceptTouchEvent = getScrollState() == SCROLL_STATE_SETTLING; boolean consumed = super.onInterceptTouchEvent(event); final int action = event.getActionMasked(); switch (action) { case MotionEvent.ACTION_DOWN: if( requestCancelDisallowInterceptTouchEvent ){ getParent().requestDisallowInterceptTouchEvent(false); // only if it touched the top … Read more

Adding a colored background with text/icon under swiped row when using Android’s RecyclerView

I was struggling to implement this feature as well, but you steered me in the right direction. @Override public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) { // Get RecyclerView item from the ViewHolder View itemView = viewHolder.itemView; Paint p = new … Read more

How do I layout nested RecyclerViews, while remaining performant?

You can’t take recyclerview inside recyclerview tag. Rather in your first adapter’s bindViewHolder call again recyclerview adapter like:- InnerRecyclerviewAdapter adapter=new InnerRecyclerviewAdapter(context,urlistArray); holder.recyclerView.setAdapter(adapter); holder.recyclerView.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); recyclerView.setLayoutManager(layoutManager); wrap_content will also work with latest recyclerview for more info check out this link https://guides.codepath.com/android/Heterogenous-Layouts-inside-RecyclerView

Android RecyclerView with GridLayoutManager make item span multiple rows

You cannot achieve this behavior with GridLayoutManager, because it only supports spanning multiple columns. Nick Butcher is currently implementing a custom SpannedGridLayoutManager that does exactly what you want. It allows you to span multiple rows and columns at the same time. The implementation is still WIP, but already works quite well. SpannedGridLayoutManager.java package io.plaidapp.ui.recyclerview; import … Read more

Android : Control Smooth scroll over recycler view

It’s unclear what you mean when you say “smoothScroll“. You could be referring to the automatic “smoothScrollToPosition” which will automatically scroll to a specified position, you could be talking about manual scrolling and you could be talking about flinging. For the sake of prosperity, I will attempt to answer all of these issues now. 1. … Read more