How can I nest a listviews with recycleviews? - android

Trying to do something like this, I attempted with a RecycleView nested with a listview. If it`s not possible, can you suggest me a more suitable UI element to get to the design?

It is best to use ViewTypes for this problem. Multiple listviews wil result in scrolling issues. Define a viewtype for different views.
Or Expandable ListView could be an option as well.

Related

nested layouts or use a RecyclerView?

in terms of performance, what will be considered better.
having nested layouts (2-3 nested layouts, reused with tag> or using Recyclerview?
Does it matter if the layout is part of an item in another Recyclerview?
In terms of updating the data when something changes?
The number of items\layouts is static (2), so there's no way it will become larger in the future.
Thanks.
I think you need using ConcatAdapter in RecycleView when scroll mutil view type. Beside you can using mutil-type, custom header, footer. Good luck :D

Multiple recyclerviews (gridlayout and horizontal linearlayout) inside one view

I am trying to achive this:
First I tried by putting all my recyclerviews (with WRAP_CONTENT) inside a nestedscrollview. That worked, but the performance was awful. Then I tried to set a height for my recyclerviews, that was a lot better (especially the first gridlayout and the horizontal linearlayout loaded very fast), but still had the problem with the dynamic "category" part.
Now I am trying to put all my recyclerviews inside a single recyclerview with different viewtypes. Since that is a pretty big deal (I need to refactor a lot of code because I have diveded every area from the screenshot inside a single fragment and now I need to put all that code inside an adapter) I wanted to ask if I can actually expect any gain from this, because in the end its again a "nestedscrollview" (made by myself, but...). Or if there is some other "best practice" way to achive this layout.
Thank you
Edit:
As expected this didnt do the trick neither. When just the two first recyclerviews are added as viewtype it scrolls and loads smoothly. But as as soon as I try to add the category items (below the category), I notice a lag and especially when selecting multiple categories and scrolling fast up, there is noticable lag. I guess I will have to change my layout and move the category selection part inside a separate view, just need to come up with a user friendly solution. But its acutally quite dissapointing that, in my opinion such trivial task, laying out multiple tables, is such a pain in the ass on android.
I didn't manage to get it working with standard android stuff.
Now I am using epoxy from airbnb ,and I have converted all my views from nestedscrollview to the epoxy recyclerview. Its a great library, and airbnb use it too for all their views.
Nevertheless it's sad that the android dev team doesn't address this problem and provide a solution besides the info "don't nest multiple scrollviews(recyclerviews) that scroll into the same direction".
You can use Recyclerview in recyclerview.
https://irpdevelop.wordpress.com/2016/02/10/horizontal-recyclerview-inside-a-vertical-recyclerview/
And make sure to use multiple view types.

Correct way to implement NestedRecyclerview

I know this topic has been 'touched' alot of times, but I still haven't found the correct way of implementing recyclerview/s inside recyclerview.
My goal is to have a single vertical recyclerview as parent and multiple horizontal recyclerviews inside of it.
I found an implementation to this within this post answer:
How do I layout nested RecyclerViews, while remaining performant?
What it suggests is, inside parent recyclerview onBindVH() method call
holder.setAdapter(childAdapter).
Is this correct way? I think, this is not the best solution performance wise. Is there better solution to implement nested recyclerviews (explanations are welcome)?

Implementing listview with scrollable views and view caching

I'm on a research to design a ListView with horizontal scroll of views - something like in the facebook app.
I also need to implement a caching for the horizontally scrollable views.
Some of the options I can think of are:
Horizontal scroll view items.
A ViewPager which I understand is not quite good for this task.
What would be my way to go on this?
I've read some StackOverflow questions and am still researching but none of what I read so far also implement caching for the scrolled horizontal views.
Just use two RecyclerViews which are nested. The backing data is a two dimensional array as the layout is two-dimensional. The outer RecyclerView passes the data for the inner RecyclerView when the onBindViewHolder of the adapter is called. Additionally you may also use different layouts or ViewHolder respectively if the inner view consists only of a single item and does not require horizontal scrolling.
Some references about implementing RecyclerViews
Here: http://www.bignerdranch.com/blog/recyclerview-part-1-fundamentals-for-listview-experts/
Here: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html
and here: https://developer.android.com/training/material/lists-cards.html
This will help you. You can use caching while scrolling. For example if you load images with horizontal scroll bar, you could use picasso library for catching and loading images.
Dont think big we have some library that will do what you want below listed some of them
https://github.com/sephiroth74/HorizontalVariableListView
https://github.com/EmirWeb/parchment
https://github.com/MeetMe/Android-HorizontalListView
any one this link will help you i belive
https://guides.codepath.com/android/Implementing-a-Horizontal-ListView-Guide
https://www.airpair.com/android/horizontal-image-galleries-android-studio

Android - expand/collapse list view without using expandablelistview

Can someone point me to the right direction or how I would go about in making my listview expand/collapse like the expandablelistview without using the expandablelistview?
The reason is I am trying to merge multiple list views together using CWC MergeAdapter and the MergeAdapter does not accept a ExpandableListAdapter so I would need to code in the collapse/expand on a regular listview.
Unless someone out there knows how I can add an ExpandableListAdapter to a Merge Adapter?
My understanding is ExpandableListViews have been phased out because they're not a preferred design solution. My first suggestion is to think of alternate navigation methods.
If you absolutely need expandable functionality you will have to make your own ListView that contains views that are dividers and views that represent content. When you click a divider, it sets the visibility of the content views it cares about to View.VISIBLE and then when you want to hide it you can use View.GONE. But, this imitates a normal ExpandableListView so why not just flatten the ExpandableListView when you need to merge it?

Categories

Resources