I have created a android app UI in which I have added a image view in recycler view and now I want is that when user swipes over the image , the comments of images should seen. plz help me to do it either by using viewpager or anything else.
I believe you can use Gesture detector classes to detect swipe event and inflate view of your image comments.
Here is the link for reference:
https://developer.android.com/training/gestures/detector
Here is the example for the implementation.
https://www.spaceotechnologies.com/android-swipe-gestures-tutorial/
Also, kindly please share your base code for better help.
Related
I am making an android app where I have listview being populated using fedor's Lazy Loading solution. This happens after I do some work in an async task and on completion of which my listview gets populated. The listview contains an ImageView and a TextView for every single row. I want to use the ViewPager implementation where on one page, I have the listview and on selection of an item in the listview, the user gets shifted to another page on the right (or maybe he can swipe to another page) where he can get the detail screen of the ListView Item. How is this possible. Do i need to use ViewPager or some implemenation of Tabs. Also if someone can refer me to some good tutorial related to ViewPager and How to implement Activities inside viewpager, that would be great!
Thanks in advance!
If you looking for the swipe than you should use GestureListener interface...
you can find this at following link
I had recently done the swiping of ListViews using viewPager it works very well
Follow this tutorial
http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-horizontal-view-paging/
You can read this from android developer site also for better understanding http://developer.android.com/training/animation/screen-slide.html
Please feel free to ask any doubts I had done this recently
Use Fragments within View Pager(not activities)
Use ViewPager if it is a listView and some other screen for the swipe.
for detail view on selection of list item, use a separate fragment and load it in the container.
Just:
Set a background that support the selected state in your list item layout, like:
android:background="?android:attr/activatedBackgroundIndicator"
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
FYI: http://cyrilmottier.com/2011/08/08/listview-tips-tricks-3-create-fancy-listviews/ and http://android-developers.blogspot.mx/2008/12/touch-mode.html
I am creating a picture gallery for newly android release jellybeans.But i got to know from here is that gallery widget is deprecated and they suggested to use ViewPager or HorizontalScrollView.I decided to use HorizontalScrollView to create my gallery.
But after a while i found that we cant set adapter to HorizontalScrollView. Now I am confused how to create my gallery in jellybeans. Help me with your suggestions.Any help will be highly appreciated.
Thank you.
Here is an article and component that subclasses AdapterView for a horizontal ListView. It uses recycling, and standard AdapterView.OnItemClickListener. Note: It does not automatically "snap" to the center view.
I'd like to create a gallery of photos that swipe left and right. At first I took a look at Gallery, but it's marked as deprecated.
http://developer.android.com/reference/android/widget/Gallery.html
We're told to try ViewPager instead. But the PagerAdapter class doesn't handle recycling of views for us (like a standard ListView), does it?
http://developer.android.com/reference/android/support/v4/view/PagerAdapter.html
Is it up to us to build the recycling mechanism?
Thanks
But the PagerAdapter class doesn't handle recycling of views for us
(like a standard ListView), does it?
No, and I think it's because it was built assuming you are using different layouts for each of the page.
Also, as it is not being scrolled as fast as a ListView (you cannot "fling" a ViewPager to skip multiple pages), I think it doesn't need to have to recycle.
This HorizontalListView is great, i used it to do exactly what you want.
see the link in the edit on this question The link in the Edit, and the answers give you some possible ways to solve.
There is also a HorizontalListView online somewhere if you search for it that makes a fine replacement for Gallery and does recycle its views.
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);
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.