I'm trying to implement my ownt picrutes gallary app. I'm using ImageSwitche for showing big image and Gallery for showing thumbnails. The problem is that when user scrolls gallery it changes selection to thumbnain whic is in the middle of gallery but required behaviour is just scroll like ListView and change image when user tap on thumbnail.
Does anybody have suggestion how to implement such behaviour.
PS. HorizontalScrollView with LinearLayout inside is bad idea becaus of it does not recycle views and holds all the pictures of thumbnails in the memory.
Take a look at the solution I have for my own question here
Basically I ended up with slightly modified version of ViewPager to display N-number of pages instead of just one. The only thing that I don't like about that that you will not have velocity-based scrolling as in ListView
Related
The thing is, I want to avoid the extra space that normally Gallery view is displaying at the end of the Gallery; like in (Figure 1)
I need to adjust it like Figure 2
How can I achieve that with out using HorizontalListView describe in here or extending Gallery.
Thank you :-)
I want to create simple application like android image gallery but I don't want to display images. I want to display an editTexts and buttons...
My idea is to use android.widget.Gallery. Is it good way to solve this?
My next idea is HorizontalScrollView but here is problems with snaps etc.
Yes, you could do this with Gallery, make an Adapter that returns your layout that contains the EditText and Buttons.
However, you should check out ViewPager
I'm try to implement disable Gallery scrolling when pictures in gallery is less than 5 pictures.If I have more than 6 pics the scrolling will enable scrolling in Gallery!
but I have no idea how to implement it. I have already reference "Gallery default item selected is in center", to adjust first picture to the left,
after adjust the first picture, I reference "how to stop scrolling gallery?" , but it doesn't work! and "Android Custom gallery to disable scrolling.." don't have any solution..
Any one have idea? how to disable scrolling the picture in Gallery?
Here I am giving you one solution whatever I am getting from your question In place of gallery You can make view like gallery by using Horizontal scroll view, add linearLayout in that and add image view dynamically if images is coming dynamically to linearLayout so it will resolved scrolling issue and left align problem as well.
I am extending Gallery class & displaying scrollable images in a horizontal manner.
I am displaying only on the landscape mode.
For displaying the images , I am using BaseAdapter , since I need to place text & icon over the images.
I am displaying the no of images based on a condition which is set.
I want to put the following conditions.
i> If the no of image to be displayed is 1 , I'll only show a single image on the middle of the screen & there should not be any scrolling.
ii> If the no of images to be displayed is 2 , then both the images should be shown side by side(horizontal) & without any scrolling.
iii> Only if the no of images is equal to or greater than 3 , then images should be displayed in the horizontal manner & scrollable.
How can I handle all the above cases using a single layout xml & by handling the conditions source code.
Kindly provide me your inputs/sample code.
Thanks in advance.
Warm Regards,
CB
well for showing the text and the image you will need to create a custom adapter override the getView method and a custom layout (a linear layout with vertical orientation containing a textView and an ImageView) inside the getView. You can find a lot of examples of doing that on google, its pretty simple.(there is the gallery example on the android developers page that explains this). Hello Gallery
For your conditions you can probably make something like this in the adapter constructor or the actual creation of the adapter in the activity. i think by default it wont be scrollable for 1 item, but for 2 it will be since the gallery centers the selected item... which is pretty lame. and for 3 or more it will work as intended (show a scrollable horizontal list of items).
Hope this helps.
I have a Gallery view, the view is loaded with 10 images. The situation I'm struggling with is when the user scrolls to the end of the gallery how do I load the next 10 images?
I added a "Next" button to fetch the next 10 images the problem with this solution is when I switch the phones orientation to landscape gallery view wont scroll anymore. Plus I read here
that you cannot put interactive controls in Gallery view.
If I implement the onScroll() or onFling() methods then I will be fetching the next 10 images without knowing if the user has reached the end of the first 10 in the view.
Your advice would be much appreciated.
There's a couple of solutions I can see.
First of all, create an image at the first/last spot to change gallery view. onClick() is supported I believe, and you can see the gallery that was selected.
The second is to have the controls outside of the gallery, ie, right below the gallery view.
Hope this helps.