Hi Folks,
Can you tell me when we select an item in GalleryView
its comes to the center of the screen how to restrict it? I want to just be there where i click that item. How? Simple words, I wanna horizontal Listview. How?
Thanks
Hi Folks,
Can you tell me when we select an item in GalleryView
its comes to the center of the screen how to restrict it? I want to just be there where i click that item. How? Simple words, I wanna horizontal Listview. How?
Thanks
HI,
I would advise you check the "Hello, Gallery" on the google doc, it is very clear. Gallery is design to "display items in a horizontally scrolling list that locks the current selection at the center", as they say.
You just need to replace the ImageAdapter by TextAdapter, and put TextViews in it instead of ImageViews. It actually work exactly like a Listview. so you know how to do a Listview, this should be easy.
EDIT
Here is I think a nice solution :
You need to change the style of the gallery. As default it is defined like that :
<style name="Widget.Gallery">
<item name="android:fadingEdge">horizontal</item>
<item name="android:gravity">center_vertical</item>
<item name="android:spacing">-20px</item>
<item name="android:unselectedAlpha">0.85</item>
</style>
So you need to create your own styles.xml in your folder gallery and put that in it :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="gallery" parent="android:Widget.Gallery">
<item name="android:fadingEdge">horizontal</item>
<item name="android:gravity">center_vertical</item>
<item name="android:spacing">0px</item> <!--This gives you no spacing between elements -->
<item name="android:unselectedAlpha">1</item> <!--This puts all elements the same alpha -->
</style>
<resources>
This gives me this :
Now I'm sure we can get better result by playing with the various attributes of the gallery and the style, but I think this is a good lead for you ;)