How to add views dynamically to Horizontal Scroll View? - android

I need to have horizontal scroll view, but the number of views in it is not static. Can one dynamically add views to a horizontal scroll view using adapters, just as we can do in a ListView?

Related

How to create a custom layout with cards scrolling horizontal and posts scrolling vertically( recycler view ) which should work with pagination

enter image description here
Here what I tried:
I can able to achieve this layout using Wrapping Horizontal scroll view and recyclerview inside Nestedscroll view.
The problem is :
When I put recycler view inside any of the scrolling containers such as scroll view or Nested scroll view
Its loading all the items in recylerview at once which is not a implementation of recylerview,hence pagination is not achieved.
Requirement:
1.Top header cards should scroll horizontally which is of a (fixed) Limited size.
2.Label for the vertical scroll view
3.Recycler view for vertical scroll of items
All the above should scroll vertically.Please help, or suggest any better way doing this layouot.enter image description here
Yes you can achieve this by having parent layout as <nestedScrollView> and in child you can take 2 recycler view of which one of them should be horizontal and another should be vertical.
set property android:nestedScrollingEnabled:true and your are good to go.

When we use a scroll view and Recycler 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.

update One Recycler view from another RecyclerView?

I have two Recycler views inside a LinearLayout in a fragment. one horizontal recycler view at the top of fragment and below that a vertical recyclerview. What i want to do is to add items from the vertical Recyclerview to horizontal Recyclerview by long touching the items.each of Recyclerviews has it's own adapter.how can i add/remove items to/from the top RV and refresh the view at the same time?

Horizantal Recycler view is loading too many elements

I have a horizontal recycler view inside of a vertical recycler view. Think of it as a slideshow inside a feed of content views. When the content view with the slideshow loads, it seems to load all 25 views rather than just the ones that are visible on screen. What I want to be able to do is set a limit on how many elements are loaded that are not currently visible. Is this possible with nested horizontal inside a vertical recyclerview?

HorizontalScrollView in View Pager

I have view pager with list of child views. Every child is horizontal view. When horizontal view is not active view pager not scroll to the next page. If horizontal view is active then It scrolls horizontally but in horizontal scroll view. I need to scroll to next page of view pager if the horizontal view is not active. So I don't know where to handle this action and how to do it.
The following is a complete example of how to implement a ViewPager with different fragment Types and different layout files.
Try This

Categories

Resources