hi i want to split my gallery with 5 images in 2 rows.
Please let me know how to do this in android using Gallery View & custom adapter for Gallery view.
Is there any sample code available please share it, i have already checked the previous posts in this site.
Thanks
If you still need this and Pagination instead of scroll will work for you, you might look at: https://github.com/sfarooq/PaginatedGallery
I designed it using ViewPager so you can manipulate the adapter to send any kind of views you want including two row views.
If you must use scrolling galleries you could implement two separate gallery in a vertical orientation and send touch events from each to the other.
Related
I am trying to implement Instagram like Search fragment where they have explore posts(contains only the image) in a grid layout and when we click on them, it changes to another feed like view showing more details.
The way I am thinking to implement is to have two fragments with recycler views: 1 for grid layout and 1 for feed like. Share the currently, loaded feed items between these two recycler view adapters.
Question: Is it the correct approach to share adapter items between two views? If not, what would the design be? I suspect I will run into issues if we share the items.
Kindly let me know if any more details is needed. I can share pictures as well in case someone needs for android device.
I went ahead and implemented my design. Till now, I haven't seen any issues.
Actually i had already posted this question but it was on hold .Well i am creating an android app which comprises of a grid view form in the Homescreen page. However i want my grid view in form of buttons that will lead to different activities.Can anyone suggest me how to do it? here is a sample of what i am trying to do:
Homescreen
You can use a GridView (link) and add your Items to it's Adapter. EDIT: The elements in this grid are then clickable and you just have to react to the clicks. Here you can find an example of how GridView is used.
The Facebook timeline seems to display all the feeds in the listview vertically. When the user shares his/her multiple photos, then those photos are displayed in horizontal list view. Has anybody any idea, how this actually works. Because I don't think nesting a horizontal listview within vertical listview works. Nor does the horizontal listview functions smoothly within the vertical scrollbar. So, if anybody has any idea about how Facebook implements its views in timeline, do share it here.
To use a gallery for the photos check out that example:
https://stackoverflow.com/a/11544447/944070
You may also need an implementation of different list items per case, so this answer would also be helpful https://stackoverflow.com/a/3515221/944070
That can be done using custom list view. Below tutorial covers facebook like feed view using volley networking library
Android Facebook like Custom ListView Feed using Volley
I wonder if there is a tutorial or example code how the effect below achieved in Android, or if someone published an adapter already for this... Basically based on the number of results returned the screen is populated with boxes, and as the finger swipes down more boxes will load on demand until the results run out.
This is a GridView. And you can use your custom Load More GridView. This is a custom ListView example of the same. You can implement your own custom GridView similar to this.
What you are looking for is a Lazy List Adapter.
There is a great implementation for it. You can check it here. All what you need next is to create the layout of your list rows, i.e the boxes.
i have two gallery views in my single UI screen or you may say activity, i want to have listener in such a way that on scroll of one gallery view the other should also scroll , i tried giving listener to one gallery and calling the other one gallery view into that ., but its working for me , pls can any one help me..
thanks in advance
Datta
You could try to find the position of one of the galleries with Gallery.setOnItemSelectedListener() and then update the other gallery with Gallery.setSelection().
I believe the Gallery view is missing a lot of functionality (or is broken) as compared to ListView or GridView. In this particular instance, you need a "setOnCenteredItemChangedListener" or something like that. However, the documentation does not show anything close to this.
One option would be to implement your own Gallery class using HorizontalScrollView.
Another (hacky) option would be to rely on your Gallery adapter to push the current position being fetched (which may NOT be the one displayed in the middle) and use that to guess the currently selected position.
You have to override the scroll event of your first gallery and inside this method you should call the onScroll event of your second gallery like this,
gallery_two.onScroll(MotionEvent e1,MotionEvent e2,x,y);