I want to display list-items in recyclerview using GridLayoutManager, I able to display data but some times recyclerview showing extra spacing in rows as like below, so how can I avoid this extra spacing.
Also I want to expand recyclerview to full height
Below is layout code of fragment
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorShopListingBackground"
android:orientation="vertical">
<androidx.viewpager.widget.ViewPager
android:id="#+id/view_pager"
android:layout_width="match_parent"
android:layout_height="#dimen/margin_124"
android:background="#android:color/white" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/margin_8"
android:layout_marginTop="#dimen/margin_8"
android:layout_marginRight="#dimen/margin_8"
android:layout_marginBottom="#dimen/margin_16"
android:background="#drawable/bg_dashboard_categories"
android:elevation="#dimen/margin_16"
android:orientation="vertical">
<TextView
android:id="#+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/margin_16"
android:layout_marginRight="#dimen/margin_16"
android:layout_marginTop="#dimen/margin_16"
android:fontFamily="#font/montserrat_bold"
android:textSize="#dimen/text_size_18"
android:textColor="#color/colorHandPickedOffer"
android:text="#string/txt_handpicked_offers" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rv_categories"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_16"
android:background="#drawable/bg_dashboard_categories"
android:layout_below="#id/tv_title"
android:layoutAnimation="#anim/grid_layout_animation_from_bottom"/>
</RelativeLayout>
</LinearLayout>
Below is list item
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#color/colorCategoryDivider"
android:paddingRight="#dimen/margin_1"
android:paddingEnd="#dimen/margin_1"
android:paddingBottom="#dimen/margin_1"
android:paddingTop="#dimen/margin_1"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="#+id/rl_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="#dimen/margin_16"
android:minWidth="#dimen/margin_136">
<ImageView
android:id="#+id/iv_category_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/margin_16"
android:src="#drawable/fashion" />
<TextView
android:id="#+id/tv_category_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#id/iv_category_image"
android:fontFamily="#font/montserrat_semi_bold"
android:hint="#string/txt_category_name"
android:layout_marginTop="#dimen/margin_16"
android:gravity="center"
android:textSize="#dimen/text_size_12"
android:textColor="#color/colorCategoryText"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
below is image with error
I have been Checking and I believe this Library Called flexbox, will help you, its going to take a bit of conversion but it is fairly easy to use and it is perfect for a dashboard like you want
Here is an extract from the page that I think will help you alot
The second one is FlexboxLayoutManager that can be used within RecyclerView.
RecyclerView recyclerView = (RecyclerView) context.findViewById(R.id.recyclerview);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(context);
layoutManager.setFlexDirection(FlexDirection.COLUMN);
layoutManager.setJustifyContent(JustifyContent.FLEX_END);
recyclerView.setLayoutManager(layoutManager);
or for the attributes for the children of the FlexboxLayoutManager you can do like:
mImageView.setImageDrawable(drawable);
ViewGroup.LayoutParams lp = mImageView.getLayoutParams();
if (lp instanceof FlexboxLayoutManager.LayoutParams) {
FlexboxLayoutManager.LayoutParams flexboxLp = (FlexboxLayoutManager.LayoutParams) lp;
flexboxLp.setFlexGrow(1.0f);
flexboxLp.setAlignSelf(AlignSelf.FLEX_END);
}
The advantage of using FlexboxLayoutManager is that it recycles the views that go off the screen for reuse for the views that are appearing as the user scrolls instead of inflating every individual view, which consumes much less memory especially when the number of items contained in the Flexbox container is large.
set android:layout_height="wrap_content" to android:layout_height="match_parent"
Related
I have created 2 recycleviews in one activity. One scrolls horizontally while other scrolls vertically. I can scroll correctly inside each RecyclerView but the page as a whole won't scroll i.e. top RecyclerView stays at the top always and bottom one stays at the bottom like both are fixed in position.
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.shakeelnawaz.recipes.AllRecipesFragmet">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="#string/trending_recipes"
android:textSize="18sp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/horizontaltrendingrecycleview"
android:layout_width="match_parent"
android:layout_height="240dp"
android:layout_marginStart="15dp"
android:orientation="horizontal"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
</android.support.v7.widget.RecyclerView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="#string/all_recipes"
android:textSize="18sp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</ScrollView>
I read this post "Scolling with multiple RecyclerViews in Layout" and set vertical recycleview's height programmatically. like this
LinearLayout.LayoutParams params = new
LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
// calculate height of RecyclerView based on child count
params.height=1150;
// set height of RecyclerView
recyclerView.setLayoutParams(params);
But the problem is that how I can calculate the height of RecyclerView based on child count?
Use NestedScrollView instead of ScrollView
and use this below line in your Fragment in Activity.
ViewCompat.setNestedScrollingEnabled(mYourRecycleView, false);
This will be work on all your Android API level.
Replace ScrollView with NestedScrollView
Then add: horizontaltrendingrecycleview.isNestedScrollingEnabled = false
Your XML should look like below:
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context="com.shakeelnawaz.recipes.AllRecipesFragmet">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="#string/trending_recipes"
android:textSize="18sp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/horizontaltrendingrecycleview"
android:layout_width="match_parent"
android:layout_height="240dp"
android:layout_marginStart="15dp"
android:orientation="horizontal"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="#string/all_recipes"
android:textSize="18sp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
I have 7 horizontal recyclerview in fragment in nested scroller the problem when I scroll the hole page or the recycler view the interface stop 1 second
I see NetFlix the film and program recycler is very fast but in my app the recycler not take from first touch
Note: my app is very similar to NetFlix
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="80dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:paddingStart="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/kufi_bold_0"
android:singleLine="true"
android:text="#string/category"
android:textColor="#color/white"
android:textSize="16sp" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/categoryRecycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:fastScrollEnabled="true"
app:fastScrollHorizontalThumbDrawable="#drawable/fast_scroll_thumb"
app:fastScrollHorizontalTrackDrawable="#drawable/fast_scroll_track"
app:fastScrollVerticalThumbDrawable="#drawable/fast_scroll_thumb"
app:fastScrollVerticalTrackDrawable="#drawable/fast_scroll_track"
android:nestedScrollingEnabled="false">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
I hope this might be help you.
For Kotlin
recyclerView!!.isNestedScrollingEnabled = false
For Java
recyclerView.setNestedScrollingEnabled(false);
In the xml layout file you can set
android:nestedScrollingEnabled="false"
by the RecyclerView attribute
Hop this helps
Hi I have a RecyclerView which contains another RecyclerView (please see the image), the inner RecyclerView does not scroll: for example look at the 7th of September in which the last activity is not visible at all but the RecyclerView does not scroll to display it.
Here's the outer layout:
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="#+id/square">
<android.support.v7.widget.RecyclerView
android:id="#+id/reciclo"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
and the inner one:
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:paddingTop="20dp"
android:layout_height="180dp"
android:layout_gravity="center"
android:id="#+id/square3"
android:src="#drawable/square"
android:elevation="2dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:minWidth="60dp"
android:layout_height="wrap_content"
android:id="#+id/lin"
android:orientation="vertical"
android:layout_marginLeft="30dp"
android:layout_marginRight="5dp"
android:layout_marginTop="30dp">
<TextView
android:id="#+id/day"
android:textAlignment="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:id="#+id/nameeOfMonthTable"/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/recicloEvent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginRight="26dp"
android:layout_marginTop="20dp"
android:layout_toRightOf="#+id/lin"
android:paddingLeft="1dp"
android:layout_alignTop="#+id/square3"
android:layout_alignBottom="#+id/square3"/>
<View
android:id="#+id/separatorDateRvCale2"
android:layout_width="1dp"
android:layout_alignTop="#+id/square3"
android:layout_marginTop="21dp"
android:layout_height="200dp"
android:layout_alignBottom="#+id/square3"
android:layout_alignLeft="#+id/recicloEvent"
android:layout_marginLeft="60dp"
/>
<View
android:id="#+id/separatorDateRvCale"
android:layout_width="1dp"
android:layout_alignTop="#+id/square3"
android:layout_marginTop="21dp"
android:layout_height="200dp"
android:layout_alignBottom="#+id/square3"
android:layout_alignLeft="#+id/recicloEvent"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
any suggestions?
I believe here you can find an answer: How to add a recyclerView inside another recyclerView
All in all, you should not nest one RecyclerView inside another one.
You can also follow this guidance for further help.
I can see from your posted code that the height of the inner RecyclerView is wrap_content. I can only guess, but I suspect that each item of the outer RecyclerView has some fixed height. This will cause the inner RecyclerView to be clipped and not scroll.
You're going to want to make your inner RecyclerView have the same height as the item it is inside of. If you're using ConstraintLayout, that would mean using 0dp height and constraining the top and bottom to the parent. If you're using some other view, that would mean setting the height to match_parent.
I have layout having RecyclerView with 5 TextViews and NestedScrollView is a parent layout. So I need to scroll all 5 TextViews with RecycleView. As per current implementation only RecycleView is scrolling. Please tell me how do i achieve this? My XML is:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:focusableInTouchMode="true"
app:layout_behavior="com.evs.demo.layout.FixedScrollingViewBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
style="#style/ToolBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/md_deep_orange_500"
android:elevation="8dp"
android:minHeight="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:scrollbars="vertical" />
<TextView
android:id="#+id/empty_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="No Records" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="No Records" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="No Records" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="No Records" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="No Records" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
For proper scrolling you can change the layout manager you have set in coding for recycler view. I hope it helps.
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity()) {
#Override
public boolean canScrollVertically() {
return false;
}
};
recyclerView.setLayoutManager(layoutManager);
Another solution
try below codes:
RecyclerView recycleView = (RecyclerView) findViewById(R.id.lastest_product_list);
recycleView.setNestedScrollingEnabled(false);
You can modify your layout
<ScrollView>
<LinearLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/lastest_product_list"
android:nestedScrollingEnabled="false"
android:isScrollContainer="false">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
Please make the height of your recycler view to "wrap_content" instead of "0dp". This will make the recycler view takes its own height and it scrolls seamlessly with the parent Nested Scroll View.
You should add 5 TextView inside Recyclerview. And 5 TextView is another view type of Recyclerview. You can follow this article to add footer type to Recyclerview.
http://takeoffandroid.com/android-customview/header-and-footer-layout-for-recylerview/
How can I get two RecyclerViews under each other in one layout? I don't want to have a single RecyclerView for all items.
My code:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="#color/main__item_background"
android:layout_height="match_parent"
android:layout_width="match_parent">
<TextView
android:text="#string/find_friends__already_playing"
android:background="#color/header"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="#dimen/list_header"
android:visibility="visible"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/in_app_friends"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
<TextView
android:text="#string/find_friends__invite_friends"
android:background="#color/find_friends__header"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="#dimen/list_header" />
<android.support.v7.widget.RecyclerView
android:id="#+id/friends_to_invite"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
</LinearLayout>
I've found the answer myself.
You need to put the LinearLayout into a ScrollView and use wrap_content as RecyclerView's layout_height.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="#dimen/list_header"
android:background="#color/header"
android:gravity="center"
android:text="#string/find_friends__already_playing"
android:visibility="visible" />
<android.support.v7.widget.RecyclerView
android:id="#+id/in_app_friends"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:background="#color/white"/>
<TextView
android:layout_width="match_parent"
android:layout_height="#dimen/list_header"
android:background="#color/find_friends__header"
android:gravity="center"
android:text="#string/find_friends__invite_friends" />
<android.support.v7.widget.RecyclerView
android:id="#+id/friends_to_invite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"/>
</LinearLayout>
</ScrollView>
Also there is a bug with with RecyclerView and wrap_content so you have to use a custom layout manager. Check out this post: How do I make WRAP_CONTENT work on a RecyclerView
You should create an XML layout file like this
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/ingredients_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/steps_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
And in the code, you should call setNestedScrollingEnabled(false)
RecyclerView ingredientsList = findViewById(R.id.ingredients_list);
RecyclerView stepsList = findViewById(R.id.steps_list);
ingredientsList.setNestedScrollingEnabled(false);
stepsList.setNestedScrollingEnabled(false);
I also had the same problem and wrote a library which helps to achieve this by joining adapters and layouts.
Gradle dependency to try it (needs jcenter repo):
compile 'su.j2e:rv-joiner:1.0.3'//latest version by now
Thea change xml to use a single RecyclerView which matches parent:
<android.support.v7.widget.RecyclerView
android:id="#+id/joined_friends_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:background="#color/white"/>
Then init RecyclerView in code like this:
//init your RecyclerView as usual
RecyclerView rv = (RecyclerView) findViewById(R.id.joined_friends_rv);
rv.setLayoutManager(new LinearLayoutManager(this));
//construct a joiner
RvJoiner rvJoiner = new RvJoiner();
rvJoiner.add(new JoinableLayout(R.layout.your_title_for_in_app));
rvJoiner.add(new JoinableAdapter(new YourInAppRvAdapter()));
rvJoiner.add(new JoinableLayout(R.layout.your_title_for_invite));
rvJoiner.add(new JoinableAdapter(new YourInviteRvAdapter()));
//set join adapter to your RecyclerView
rv.setAdapter(rvJoiner.getAdapter());
You can check this link for more library details and explanation. Hope it helps.
if you get the bottom recyclerview not scrolling with the main content, change the LinearLayout (see answer from alan_derua) to ConstraintLayout and wrap the two RecyclerViews inside. See code below:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout
android:id="#+id/task_list"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="#+id/first_list_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="#+id/textView3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="#+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:gravity="left"
android:paddingTop="0dp"
android:text="#string/my_tasks"
app:layout_constraintBottom_toTopOf="#+id/second_list_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/first_list_view" />
<android.support.v7.widget.RecyclerView
android:id="#+id/second_list_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView3" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
This worked for me!
You can give each RecycleView height equal to 0dp and weight equal 1:
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"
Use NestedScrollView as parent layout, it should have
android:weightSum="2"
and give
android:layout_weight="1"
to each RecyclerView of yours.It should be scrolled one after each other.
Just use:
<android.support.v7.widget.RecyclerView
android:id="#+id/card_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:scrollbars="vertical"
android:layout_below="#+id/your_first_recycler"/>
last line is for your problem.use it.