My RecyclerView has many rows but shows only one row? - android

its recyclerview inside recyclerview inside recyclerview
it seems to be OK even the row is added but it doesn't show any thing.
many questions like this asked already and answered but none solved mine
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/fn_file_field_card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/fn_field_margin_right_and_left"
android:layout_marginTop="#dimen/fn_field_margin_top_or_bottom"
android:layout_marginRight="#dimen/fn_field_margin_right_and_left"
android:orientation="vertical">
<ir.tenthwindow.lbs.views.PersianTextView
android:id="#+id/fn_file_field_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="btn"
android:textColor="#color/black"
android:textSize="#dimen/fn_field_text_size"
android:textStyle="bold" />
<ir.tenthwindow.lbs.views.PersianTextView
android:id="#+id/fn_file_field_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/button_green"
android:gravity="center"
android:maxLines="1"
android:padding="10dp"
android:text="#string/upload_file"
android:textColor="#color/white"
android:textSize="#dimen/fn_field_text_size" />
<android.support.v7.widget.RecyclerView
android:id="#+id/fn_field_images_RecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="#dimen/fn_field_line_margin_top"
android:background="#color/fn_grey_line_border">
</View>
</LinearLayout>
</android.support.v7.widget.CardView>
Thx in advance for helping me

As mentioned, you need a layout manager for recyclerview to work. This can be added in xml, or programatically. In xml:
<android.support.v7.widget.RecyclerView
android:id="#+id/fn_field_images_RecyclerView"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
Or programatically:
LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
yourRecyclerView.setLayoutManager(layoutManager);
Please note, there is also a GridLayoutManager if you want a grid layout.

Try to change height of recyclerview to match_parent instead of wrap_content.
<android.support.v7.widget.RecyclerView
android:id="#+id/fn_field_images_RecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
& height of layout in adapter to wrap_content if you set it as match_parent.
Also, set LinearLayoutManager to Vertical orientation.

Related

Recyclerview using gridlayout showing extra spacing

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"

RecyclerViews inside ScrollView is cutting off the last item

I have a ScrollView with a LinearLayout, and several different RecyclerView inside because I load data from different sources.
<?xml version="1.0" encoding="utf-8"?>
<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:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/posts_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:clipToPadding="false"
android:padding="10dp"
android:layout_marginTop="20dp"
android:nestedScrollingEnabled="false"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/movies_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:clipToPadding="false"
android:padding="10dp"
android:layout_marginTop="20dp"
android:nestedScrollingEnabled="false"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/tv_shows_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:clipToPadding="false"
android:padding="10dp"
android:layout_marginTop="20dp"
android:nestedScrollingEnabled="false"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/music_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:clipToPadding="false"
android:padding="10dp"
android:layout_marginTop="20dp"
android:nestedScrollingEnabled="false"/>
<android.support.v7.widget.RecyclerView
android:id="#+id/books_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:clipToPadding="false"
android:padding="10dp"
android:layout_marginTop="20dp"
android:nestedScrollingEnabled="false"/>
</LinearLayout>
I use both LinearLayoutManager and GridLayoutManager to organise the content showed by the recyclerviews.
GridLayoutManager layoutManager = new GridLayoutManager(context, 2);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(adapter);
For some reason, the last element of the second RecycleView (with a GridLayout) is getting cut off.
While elements of the other RecycleViews are showed in the correct way.
I don't know if it is important, but inside the RecycleViews I use CardViews.
Any help would be greatly appreciated since I am going nuts with this problem :(
SOLUTION
The solution is simple: I just used NestedScrollView instead of ScrollView and it works fine.
Use the Nested Scroll View instead of Scroll View in this situation.
putting a bottom margin on linear layout will solve your problem.The bottom margin should be the height size of recycler view row.

How to scroll other views with recyclerView in android?

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/

RecyclerView inside ScrollView, some items are not shown

I had a RecyclerView in ScrollView like this:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--other stuff-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
</LinearLayout>
<!--other stuff-->
</ScrollView>
And the RecyclerView's item is a RelativeLayout, inside of which there is an EditText and other views. The layout_height of that RelativeLayout and EditText is both wrap_content. User can input into that EditText without any limit of length/lines so that each item's height is different.
Then I found that getItemCount() in Adapter returns true value but onBindViewHolder() is called of wrong times(less than it should be), thus not enough to show all items.
I found that this will happen only if I wrote recyclerView.setNestedScrollingEnabled(false). But I cannot remove this line. Because if I did so, the RecyclerView won't scroll smoothly and is not harmonious with other views inside ScrollView and ScrollView itself.
This occurs on 6.0 but not on 4.1.
I communicated with Google at this page: https://code.google.com/p/android/issues/detail?id=213914 and he told me this is a bug fix for RecyclerView. You can visit that page so that you can understand the question and my goal better(There is a small sample project to show the problem there). I don't agree with him even now and I want to solve the problem. Please help, thank you in advance.
I found the solution myself: replace ScrollView with NestedScrollView and keep recyclerView.setNestedScrollingEnabled(false). I don't know if this is what NestedScrollView is made for but it works.
NOTICE:
NestedScrollView is not a child of ScrollView but of FrameLayout.
This solution will also bring some bugs with self-simulated adjustResize.
In my case, I replaced LineaLayout with RelativeLayout and it's solved the issue and all items have shown.
The answer is:
androidx.core.widget.NestedScrollView
In the first step, you need to create NestedScrollView element in XML:
<androidx.core.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">
// RecyclerViews should be located here
</LinearLayout>
</androidx.core.widget.NestedScrollView>
Next, add the below attribute to recyclerView:
android:overScrollMode="never"
Then, the recyclerView will be as following:
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never" />
Finally, the whole the layout will be something like below, you can add other materials inside LinearLayout:
<androidx.core.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">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never" />
// other materials
</LinearLayout>
</androidx.core.widget.NestedScrollView>
Celebrate.............;)
The best solution is to keep multiple Views in a Single View / View Group and then keep that one view in the SrcollView. ie.
Format -
<ScrollView>
<Another View>
<RecyclerView>
<TextView>
<And Other Views>
</Another View>
</ScrollView>
Eg.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="any text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="any text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>
Another Eg. of ScrollView with multiple Views
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/CategoryItem"
android:textSize="20sp"
android:textColor="#000000"
/>
<TextView
android:textColor="#000000"
android:text="₹1000"
android:textSize="18sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:textColor="#000000"
android:text="so\nugh\nos\nghs\nrgh\n
sghs\noug\nhro\nghreo\nhgor\ngheroh\ngr\neoh\n
og\nhrf\ndhog\n
so\nugh\nos\nghs\nrgh\nsghs\noug\nhro\n
ghreo\nhgor\ngheroh\ngr\neoh\nog\nhrf\ndhog"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

Two RecyclerViews under each other in one layout

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.

Categories

Resources