Display gallery elements as a circle - android
Hi I am using the gallery for displaying images. But the gallery has an end. I don't want this behaviour; I want to repeat the images again and again on both sides of the gallery. Is there a way to display the gallery elements as a circle?
I wrote a tutorial on how to create circular gallery.
Read it in my Blog Post here:
http://evgeni-shafran.blogspot.com/2011/08/tutorial-custom-gallery-circular-and.html
Here is what i did:
In the adapter i used, i made him think he have a really big element count.
and then each element position= position%element.lenght
and then i made the first position in the middle.
so what happen is this: (lets do it for 3 elements, you can have what ever amount you like later)
This is how the adapter see the elements:
1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3
now you tell him that the first element is in the middle:
1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,->1<-,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3
if you make it a really big number, the user can scroll a lot before getting to the end.
Hope it helped you.
Related
ImageSwitcher / Gallery with bullet point below the image
I am trying to put a ImageSwitcher and Gallery in my app, however, I want the gallery part just with some bullet points instead of the thumbnail of the original image. Just for some more explanation to make it more clear. Assume there are three image in my ImageSwitcher and there are three bullet point according to them. When the first image is displayed, the first bullet point is colored while others are remain white. When the second image is displayed, the second bullet point is colored while other are remain white...and so on. I think that feature is quite common in many app or website, but I really don't know how to describe it with keywords. Hoping that someone can understand and give me a help. Thank you in advance.
I think you should consider using ViewPager and ViewPagerIndicator instead of ImageSwitcher and Gallery widgets. Gallery was deprecated since API level 16.
You can use View pager and corresponding third party library for indicators as https://github.com/JakeWharton/Android-ViewPagerIndicator library for view pager indicator and view pager http://developer.android.com/reference/android/support/v4/view/ViewPager.html.
Overlay 50% of each image in gallery
I'm looking for a way to overlay each images of the gallery to 50%. I have successfully do that with the setSpacing method gallery.setSpacing((int)(- this.imageWidth / 2)); The problem is that now, we don't see the image at the right of the selected item in gallery, because the selected item is fully displayed. I want to keep this comportement (image selected fully displayed), but also see the image at the right (50%, like each other). Moreover, and it's an other problem, i'm looking for a way to display my images differently at the left of the selected element than at the right of the selected element. It's a little difficult to explain, so I have drawn the result that I want have : http://www.hostingpics.net/viewer.php?id=678746customgallery.png As you can see, the image at the left (yellow) of the selected one (purple) and the image at the right (pink) of the selected one (purple) are side by side because of the difference of disposition between left and right. I'm french and it's a problem very difficult to explain for me, if you don't have well understand, please ask me for more precision. Thanks per advance for your help. Sébastien EDIT : Thanks to Ramon's answer, I have found this to solve my problem : rudolphmutter.com/?p=31. However, this give me a new problem now, the same as this guy : stackoverflow.com/questions/8598863/. Even I accept the answer, that fit to my question, I'm still waiting for a solution to do what I want in the other stackoverflow's subject.
maybe you can use setChildrenDrawingOrderEnabled(true), then, your selected image will be displayed at the top of the gallery.
Image Count Indicator in Android
I am displaying an image gallery consisting of 15 images with image displayed on the screen (full-screen) at a time. When the user swipes across, the image changes. I am looking at a small polka-dots style indicator at the center-bottom of the screen to show the image count and where the user currently is. eg: If my gallery held 5 images and the user was currently on the 3rd image, then there would be 5 polka dots with 3rd dot highlighted/filled with color and the rest polka-dots be hollow. I know the description might sound a little vague but in short, I am looking at an image count indicator! :) Thanks!
You might check out this Android Count Indicator project: https://github.com/rupertbates/android-count-indicator
I know exactly what you want, you are looking for the PageControl that is used on iPhones with the Scroll Views. I have never seen anything like that for Android. You would have to build a custom view. It's explained here: Building Custom Android Components
I finally found it in the Launcher code!
What is the best view for a displaying an images in android?
I'm designing an app that splits an image into a 3 x 3 grid. What is the best way to display this image. Also, How can I move this piece from one point to another on the view. Thanks.
Use an ImageView? I don't understand your second question. If you are talking about trying to show the 3x3 grid, use a GridView. You can mess around with the ScaleType and image matrix to change what part of an image is displayed.
ListView and images displaced in the getView method
I have extended an ArrayAdapter to manage a ListView using a certain tamplate (made of 1 ImageView and 1 TextView contained in a RelativeLayout) as row of the list. Anyway I am now facing some optimization issues. As you guys know, not all the rows are rendered at any 1 time but rather you get the rows progressively rendered when the user scrolls the list and they actually appear on the screen. Basically my problme is this: when the list is scrolled really rapidly, the rendering engine cannot keep up with the speed and, although the images to display are cached, the placement of the images in the ImageViews of the visible rows take some time. To be honest I was expecting the getView method to be really fast but apparently when it comes to images there are some tricks to know. Any1 wanna share ?? cheers ;)
You may take a look at my sample. It does exactly the same Lazy load of images in ListView.