I need my ViewPager to act like ListView, I mean if you start scrolling and took finger off listview proceed scrolling for some time. Maybe, somehow You know how to implement this in ViewPager?
Maybe you should try HorizontalScrollView?
http://developer.android.com/reference/android/widget/HorizontalScrollView.html
Related
I implemented ViewPager in ListView items. In general works perfect, but have some issue.
When I scroll ListView and then touch on screen (during scrolling list) in this case I can't scroll ViewPager in this item, ListView has focus. I should select it again for ability to swipe. ListView has returned SCROLL_STATE_TOUCH_SCROLL state, when I touch it during the scroll. At this moment I should focused on ViewPager for ability to swipe items.
Can I solve this issue without any scroll conflicts in ListView and ViewPager? I guess that it's imposible, but, decided to ask here.
Or, maybe you can advice me to use some other control to implementing swipe in ListView items. But scroll animation should be the same as on ViewPager.
Thanks for any advice.
Depending on your XML, you end up with needing to implement OnTouchListener. If the view you want to handle the event can handle it, then return true, if not false. Then the parent can handle it. You might also want to look at ViewGroups, particularly the onInterceptTouchEvent.
I have an HorizontalScrollView in my design, which I populate with a variable number of items. The problem I have is that sometimes I populate it with many items, so the ScrollView shows scroll bars. That's OK, but I would like to check this situation and show a Previous and Next buttons in this case.
How can I do this?
I don't think ScrollView has a scroll listener. Synchronise ScrollView scroll positions - android might help you for creating a custom one.
I'm trying to figure out the best approach to design a horizontal scrollview from android >= 2.1 with some text over the image that when scroll if end is reached it starts showing the first items again hence carousel behavior.
You can continue scrolling horizontally, forever, and the first item shows up again when the end is reached, for example when scrolling swiping to the left. It can be a view pager with an adapter, a carousel but not horizontal scrollview as it does not support some android device.
Any suggestions would be greatly appreciated.
Why not use a ViewPager? As it is available in the Support Library. I would insist to use ViewPager instead of HorizontalScrollView or Gallery. You can check an example for ViewPager from my github.
UPDATE
To show multiple views inside a Fragment you can use getPageWidth(). Check here for reference.
For future people looking for this, here's an excellent library that fit my needs for a similar problem!
https://github.com/sparrow007/CarouselRecyclerview
I need to implement a UI like this:
In the above screen row needs to be scrolled horizontally and columns need to be scrolled vertically.
I have not used Gallery as It is being deprecated. Here are some scenarios which I have tried:
1. Combination of GridView and ListView.
2. Combination of ListView and Horizontal ListView(Custom Component).
Option 1 did not work for me but I could make it with option 2.
With option 2 perfomance is not good.
Solution: I am thinking of implementing 4-5 horizontal listviews inside scrollview with Gestures so that I can handle the vertical swipe thru code or by subclassing the ScrollView and overriding the onScrollChanged method.
But I am looking for some more optimized solution.
Any help is appreciated.
Thanks
Use webview and push the content into it through JS hooks.
I have gone with my solution if anyone can suggest a better solution then obviously I will go with it:
Solution:
Implemented 4-5 horizontal listviews inside scrollview with Gestures
and handled the vertical swipe thru code or by subclassing the
ScrollView and overriding the onScrollChanged method.
Im having trouble with my UI.
It contains a ListView , with ViewPagers as List Items.
The problem is that the horizontal scrolls seem to get interrupted by the ListView (catching vertical scrolls).
What i want to achieve is that no matter what happens, the horizontal scrolls finish all the time. Right now they stop half way sometime.
this is probably a common problem, but i havent found a solution yet.
I've tried to intercept horizontal scrolls on the the listview, but although I can intercept, it still causes the swipe to stop.
can anyone point me in the right direction ?
ViewPagers are not compatible with ListViews.
Sorry.
ViewPager inside ListView