Note that there are some explanatory texts on larger screens.

plurals
  1. POImage Gallery like the one on Google Play? (with viewing the next image)
    primarykey
    data
    text
    <p>I have tried to implement an image gallery like the one on Google Play store, where the next image is visible:<img src="https://i.stack.imgur.com/D1bKj.png" alt="enter image description here"></p> <p>I have tried different approaches for this but hit a dead end for each one:</p> <p><b>1. Using a PagerContainer</b> (<a href="https://gist.github.com/8cbe094bb7a783e37ad1" rel="nofollow noreferrer">here</a> info) But this solution does not work for me on any 2.x devices as the next image is not visible and the ViewPager scrolls only inside its bounds (error with no answer posted <a href="https://stackoverflow.com/questions/12495344/viewpager-and-setclipchildrenfalse-workaround-for-2-x-devices">here</a>)</p> <p><b>2. Using a HorizontalScrollView</b> This solution has proven to be good for what I have wanted in terms of design and functionality, but because the HorizontalScrollView supports only one child view, it draws the whole view so I had memory issues for some devices. I receive images from a server, and they are large in number and also in size. So a dead end was hit here too.</p> <p><b>3. Using a HorizontalListView (info <a href="https://github.com/dinocore1/DevsmartLib-Android/blob/master/devsmartlib/src/com/devsmart/android/ui/HorizontalListView.java" rel="nofollow noreferrer">here</a>)</b> This was sounding like an alternative for HorizontalScrollView, as an Adapter was used, so memory problems were solved. However, I could not managed to properly modify this class to change its measurements once the image was loaded from server. As you can see, it measures its childs keeping in mind the parent's measurements. When I define the views, the images are not received yet from server, so the measurements are not correct. Once the images are received, I did not managed to correctly force remeasuring the views.</p> <p><b>4. Setting ViewPager margins to negative</b> This solution did not worked for me as the measurements were not correctly displayed once I started scrolling. (the first view displayed the set margin and the next image was visible. However, after starting scrolling, some images had margins, other not, some only on one side etc.) I do not know if here there is a solution of constantly measuring the views and screen.</p> <p>I could post code for one of the solutions, if you think it is the proper one. But I feel Google Play uses another solution that I do not know about. I do not want to use a Gallery as it is already deprecated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload