synchronize scrolling of gallery views - android

I've been stuck with this situation for few days now. My problem is I've multiple gallery views and I want to make the scrolling of all the gallery views synchronized. So if one gallery view is scrolled I need to scroll all the other gallery Views in my layout at the same time and the entire view should seem like it's one coherent view getting scrolled and not multiple views.
I've to use multiple gallery views and using a horizontalScrollView or anything else doesn't seem to be a good option in my case.
I found a similar question here:
Synchronize two Galleries but there are no solutions.
Right now I'm out of ideas and any pointers will be helpful

Related

Recycler View Scroll to middle of screen

Hello I am not sure if this would be a duplicate as my wording is probably not the best to describe this on a search. I have a recycler view with a list of strings. Everything works great however, is there a way to make the list scroll a little higher than the bottom of the parent view, in this case keep scrolling up until it hits the middle of the screen? the Recycler view would height is match parent. Thank you in advance!!
Please note: I didnt add code since this is just a regular recycler view nothing special added, let me know if the code is needed as well thank you!
Edit:
this is for a vertical scroll list only. The following images are some list images I got offline but hopefully they can show better what I am trying to accomplish:
I want to be able to scroll the list up to the middle as in the following picture for example:

Android : How to load images in Horizontal Scroll View only it is visible

I want to add some images to an Horizontal Scroll View and want these images to be loaded only when the user scroll the horizontal scroll and the image come to the visible area .
I built a custom layout that extends linear layout to hold the image
And tried to add the loading of the image to
onFocusChanged
onWindowVisibilityChanged
onWindowFocusChanged
but nothing is working
any help ??
This type of problem is better solved with a RecyclerView. It'll handle horizontal scrolling, image loading when views becomes visible, and recycling views for better performance over large data sets. Among other things.
There are tons of tutorials out there, find one that suits you're style and dive in!

Image viewpager inside listview not scrolling

I know this question has been asked many times, and I have looked everyone of them here but none of which helped me.
What I am trying to do is to mimic the UI from iOS where you have a UITableView with cells that are UICollectionView. The cells are images that page horizontally. I am trying to do this with a listview of viewpagers.
My current solution is I create each row before hand. It is a linearlayout with a title, the viewpager, and two buttons on the bottom. I already created the adapters for the viewpagers as well. In the getView method of listview, I just return the view in the created collection based on the position as the index. I know this is bad practice, it uses a lot of memory, but the method is just one line.
I have tried the viewholder pattern, but only some rows in the listview will get the viewpager. The recycling mechanism doesn't really help in my situation, so I sacrifice more memory for the same effect.
So I can see all the viewpagers in my listview. The problem now is that only the bottom 2 are able to page from iamge to image. The ones on position 0,1,2, couldn't. I thought it has to do with listview intercepting the events, but how come the ones on the bottom work perfectly??
Any help is appreciated!

How do I implement such a layout?

Photos in this layout can be swiped left and right, and swipe should be 'intelligent', like switching between photos and NOT like just horizontal scrolling of photos.
2 implementations that come to my mind:
HorizontalScrollView (but swiping is dumb)
ViewPager (but there is no way to see adjacent photos)
So, basicly I need a ViewPager for photos that can show adjacent photos.
Is there a robust solution for this?
For cool swiping action viewpager is the best. And you won't have problems with memory. BUT I have no idea how to make view pager part of listview.
If you have final number of items you can use Android Gallery widget which is deprecated since api 16 but does exactly what you need, the main problem is that it cant reuse gallery items inside the adapter.
You also can try this:
Horizontal list view
I have used TwoWayView to implement my layout.
It's better than HorizontalView, cause it re-uses views (like ListView).

Limit Scrolling of HorizontalScrollView

I implemented Gallery using Horizontal scroll view by referring some tutorials on google. I tried gallery with gallery widget but its crashing on ics. so i went for horizontal scroll view. I implemented it successfully but i want to limit scrolling of it to 1 image at a time like the way we do in gallery.
Please help me with this.
Its quite more easier with ViewPager. I found now.Pager moves only one item at a time.
I followed
View Pager Example in Android Development

Categories

Resources