I would like to implement the same pull-to-refresh UI pattern used by the Twitter app.
I have been trying to use a RelativeLayout containing a ListView, but it's really slow. How can I make it as smooth as Twitter?
I have been using the Listview's onTouch callback to get the MotionEvent, detecting when the listview is already scrolled to the top and the touch is moving downwards. Then, I adjust the top margin of the listview based on the Y coordinate. But surely that's not the way to do it, as the Listview moves down in little steps, not smoothly.
Do you know which layout should be best used?
Below is just a screenshot from the Twitter app:
UPDATE:
I think I found it. I believe the smoothest implementation is by using the ListView header. So, no need to use a viewgroup like RelativeLayout. Everything could be implemented within the ListView.
Android has a SwipeRefreshLayout for this purpose.
https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html
Related
I want to create a scroll view with pages that can be scrolled vertically and horizontally as well.
The scroller should be just like a slideshow on a website, to slide between images (content). Something like ScrollView, but to stop at a certain point when scrolled.
I am using this in Xamarin.Forms, so I'll need to create a custom renderer (Android) and set the content of the pages from Forms.
I tried ViewPagers, but I want to be able to set the content from Forms page, not from predefined layouts...
I just couldn't find a clear example/tutorial so I can understand how to approach this problem. I also think about overriding some methods from ScrollViewRenderer class, to intercept and only slide to a certain point, but have no idea which methods and properties to change.
Something like CarouselPage on XF, which can be used inside a layout.
Any help or examples would really be appreciated. Thanks!
I'm searching for 2 days for a solution for this problem.
I'm trying to find the best way to approach implementing Facebook like floating last row on Grid view.
when scrolling down, the status-photo-checkin disappear to allow more space for the list, and when scrolling up it appears again. anyone has an idea how can I implement this or direct me to an existing component/library?
I have seen the post Android Listview Floating First Row and try the Quick Return pattern: https://plus.google.com/u/0/+RomanNurik/posts/1Sb549FvpJt
But it does not work for GridView.
Check out this QuickReturn library I wrote.
https://github.com/lawloretienne/QuickReturn
It even has an example of how its done in Facebook.
Is there example android code or sample android app which demonstrate animation of the views while scrolling.
For example. In a scroll view some items are not visible when you scroll the items will start to come inside the screen that time i just want to animate that view.
any help would be greatly appreciated.
Thanks.
Download this app. Here you will find tons of libraries of your use. I also seen the library which your are asking in this app. You will find source code links in the app as well.
https://play.google.com/store/apps/details?id=com.desarrollodroide.repos&hl=en
Or You can do one more thing
Just add on scroll listener and some more listeners are there by which you can detect which portion of your scroll view is visible.
Then You can add animation to those views.
Try Listview animation library.
Modify it and use.
https://github.com/nhaarman/ListViewAnimations
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.
I am using a ScrollView to display a list of items that are inflated on runtime. Like a feed of updates for the user.
While thinking about the options i got to let the user update the view with new notifications I thought about the pull to refresh feature in the twitter app.
Anyone got any idea how and if can it be implemented with a ScrollView ?
Saw there are some implementations for that using ListView but I don't like the idea of changing all of my platform to gain this refresh effect.
There is a solution introduced for implementing pull to refresh for various component which are scrollable like listview and scroollview.
Look at ChangeLog link https://github.com/chrisbanes/Android-PullToRefresh
ListView with just one element can be treated as a ScrollView. You can use the implementation for pull-to-refresh ListView and add just one item in it. I had used this trick in the past.
You can do that. You can increase the top margin of the scrollview when the user moves the finger down and the scrollview it's on it's top. Then on release fire the update and decrease the margin with animation.(You have to create your own animation to pull that off). That's the idea. If you want more particular help ask what you cannot implement.