I have a RecyclerView adapter and in each view holder I have nested view group (TagGroup https://github.com/2dxgujun/AndroidTagGroup)
The performance is horrible while scrolling with these nested ViewGroups
My adapter even uses sethasstableids(true) which speed up scrolling performance slightly
My question: Is there any way to stop certain parts of onBingViewHolder() code while scrolling i.e. the section where the view group is populated
I know so that some image loading libraries have way to stop loading image while scrolling
below you can see the TagGroup (ViewGroup) in each view holder
https://drive.google.com/file/d/0B-fCQa73GiDYZDgtMXJoR2k2M045Nm10dDRRLXA4RW9YaGZB/view?usp=sharing
Related
I am using recycler view with linear layout manager, based on some logic I am hiding/showing a view inside recycler view item.
Issue Problem occurs when I scroll, I can see some gaps in between recycler view item, which are random when scroll. If I hide the view always , then there is no issue, but I need to show and hide based on some logic and when implemented the gaps are coming as well.
Assumption One thing I am sure of is that the issue is there because of hiding/showing a view.
In a app we have a activity which displays a list of textview let us take a list of numbers 1-9 or more than that.Which view is useful to display textviews either scroll view or Recycler view?
Recyclerview itself has scrollbar implemented in it. It is used when you have a large dataset.
ScrollView is used when you have a limited set of children on your UI and they are fitted out of your screen, so ScrollView is implemented here to scroll your layout to see all the children.
My question is why do wrap recycler view into nested scroll view
Does it relate to smooth scroll of recycler view
Actually i am creating app which fetch 2 images and the scroll of recycler view in that is very slow so should i wrap it into nested scroll view for smooth flow or compress images and store them
I am a bit confused on this topic ?
Wrapping Recycler view in scroll view is like a two sided blade. You should be careful about using it.
because when you use it, the recycler view will loose its advantage of recycling unneeded rows so at the same time you will have references to all those view, so if you have rows with many graphical item it will make problem for slow devices.
If you see putting the recycler view inside another nested scrollview solved your speed problem, It means you do a mess in the adapter of recycler view.
Do not do any heavy process in adapters and onBindViewHolder
I have recycler view with different type of cards inside it with lots of images and nested recycler view for every card. While scrolling recycler view I am getting lot of jerk can someone help me on this.
I have a ScrollView that contains several other views and I would like for one of these views to be a grid of other views having the same layout (e.g. ImageView).
Since having one scrollable view inside another is not recommended, I would like this grid view not to be scrollable, otherwise I would have used GridView or RecyclerView.
Surely I can place the grid views inside one of the standard layouts (e.g. TableLayout) but this may cause memory issues when many grid items exist.
Is there any standard approach or a library that allows to recycle views for a non scrollbale view inside ScrollView?
If you try to force GridView or RecyclerView to be non-scrollable (so basically you would have to force the dimensions of the view to display all the elements) you will end up in the same situation as if you used TableLayout (so you would need to watch out for memory issues).
If you disable the scrolling of scrollable (recycling) elements like GridView/RecyclerView you disable the most important part that makes those things work efficiently (that makes those things reuse their views).
The way you should solve your issue is to implement your other Views of your ScrollView as a part of the RecyclerView. Your RecyclerView should be equipped with the adapter that can inflate multiple types of Views (you can read about it for example here).
Since you are using RecyclerView you could use NestedScrollView instead of ScrollView They should play more nicely since RecyclerView extends from NestedScrollingChild and NestedScrollView extends from NestedScrollingParent.
Other views you can use are VerticalGridView or HorizontalGridView but as you said you are worried about performance issues and you can provide a GridLayoutManager to the RecyclerView I would stick with that.