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 :-)
Related
I want to create an image slider using the HorizontalScrollView. Indeed, the slider will display one image at the time and I want to be able to use the fling gesture to navigate left and right in the slider.
Any Idea to which methods to override in the HorizontalScrollView to achieve this.
Thanks a lot.
Best
You could use Gallery with Image Switcher view to achieve this
This Link is usefull to you for better way to implement Android HorizontalScrollView to move image one by one.
Link :http://saigeethamn.blogspot.in/2010/05/image-switcher-view-android-developer.html
video: http://www.youtube.com/watch?v=c6a6wTfSPJA
EDIT :
If you want to implement Complex way refer this Links
Link1
Link2
You'd be better served implementing this with a Gallery widget or a ViewPager. These elements handle the display and interaction portion for you; you just have to provide the data behind that. If these don't quite work for you, better to customize one of them then start all the way from scratch.
Gallery Docs
ViewPager Docs
You can use any of below things for your need
Gallery - A view that shows items in a center-locked, horizontally scrolling list.
ViewPager -Layout manager that allows the user to flip left and right through pages of data. You supply an implementation of a PagerAdapter to generate the pages that the view
shows.
HorizontalScrollView -Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display
for reference see these links - Gallery , ViewPager and HorizontalScrollView
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
What is the best way to create a slideshow in Android?
Basically, what I need is to slide through a collection of LinearLayout or RelativeLayout objects, that contains inside them different views, ex: an ImageView and a TextView overlayed on that image.
On the bottom of the screen, should be some bulled points that will keep track of the currently element in the gallery.
To give an idea take a look at this jQuery implementation: http://slidesjs.com/
(I don't need the "left"/"right" controls, and the bulled points also dont need to be clickable, as in example)
Also, the slideshow should be in a cycle.
Maybe not the best, but I used a Gallery.
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 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.