Alright, I want to do something like a Gallery of images, scrolling from left to right. The user is going to register barrages, and he needs to take many picture of this barrage. I already know how to save the data, and how to show using listview with adapter, I did with listview thinking that I could change to horizontal somehow, but I searched and I can't. What should I use to do that? What I want is a gallery with the first photo being a plus to when you click it opens a new intent that take a picture and a description of the pic and save it, I know how to do that with listview, but it's not what I want. I saw that gallery view is deprecated, so I should use HorizontalListView?
2 Answers
Use linearLayout that is placed in horizontalScrollView and on runtime Add pictures to that LinearLayout that has orientation set to horizontal. Best practise will be create your own class where you will have specified LayoutParams that you will apply to each ImageView generated on runtime , then you just need to add it to layout.
You can define method like addPictures(LinerLayout yourLayout,int amountOfPictures,Array pituresPaths) that will be loop which will create ImageViews for specified amount of Pictures and paths you can take from Array
Edit
Like xoxol_89 mentioned you can use Fragments , advantege will be that FragmentAdapter dynamically recreates and destroys fragment objects so that solution with many pictures will be more memory resource efficient

- 408
- 1
- 5
- 13
-
Got it. Thanks for your answer. I'll try that. Thought that Android would have something to do that. – Jonas452 Apr 10 '14 at 11:35
Gallery is deprecated, yes. So maybe HorizontalListView. But i think, that you can use fragments with animation

- 1,242
- 11
- 17
-
Do you have any example with fragments and animation? Never used fragments. – Jonas452 Apr 10 '14 at 11:41
-
You can search on this site) For example [link](http://stackoverflow.com/questions/4932462/animate-the-transition-between-fragments?lq=1) – xoxol_89 Apr 10 '14 at 15:47