Extending AbsListView example - android

I would like to build a custom List (Pinterest grid layout) and I would like to extend AbsListView. Are there good examples around? It seems very very difficult.
Thanks
Tobia

i've created a nice post about this and found out this is the best one.
however, do note that just like the other libraries, it has its own issues. what i've found is that when you call notifyDatasetChanged() on it, you get weird pairs of views and positions on the getView method (link here about this issue). also i've found out that it doesn't call the "onScrollChanged" method at all (link here about this issue)
even though this library is nice, i would also like to see a tutorial on extending the abdListView.

Related

Recycler View custom scrolling effects

I want to make awesome scroll effect. I've found a couple of examples:
http://lab.hakim.se/scroll-effects/
but I have no idea how to such behaviour. I consider to make it on my own, but it will be good to have a library which I can use. Just need some starting point. Any ideas?
I've used this library a few times and seemed good but seems to be in need of an update since some of the delete animations have problems. But the scrolling animations should still be good:
https://github.com/wasabeef/recyclerview-animators

How to implement customized stack view in android?

I have searched the internet but I couldn't find some good explanation or advice.
Basically, I want to implement this functionality.
on slide down
I used the StackView class and all I get is this "diagonal" stack
I want views to be one behind another, as in the pictures above.
Similar question is asked here -> Android customize stackview, but I couldn't find any satisfying answers.
I have read the code for StackView as suggested, but honestly, I don't know how would I customize it to get what I want.
When I change the value of PERSPECTIVE_SHIFT_FACTOR_X or
PERSPECTIVE_SHIFT_FACTOR_Y nothing changes and I get the same "diagonal view". Am I missing something?
Thanks in advance for the answers.
Feel free to use my library available here.
It does exactly what you want and is based on the ViewPager so you can use it with just a typical PagerAdapter of your choice.
You can't change the original PERSPECTIVE_SHIFT_FACTOR_X because it's a private field.
StackView uses many classes which have package visibility and are only usable in package android.widget.
Furthermore some of those classes are pre-compiled and the source is nowhere to be found, so you can't just copy-paste them and create your own custom StackView from zero.
You can make the views appear in a column by overriding onLayout, but once you animate them, their positions are changed back to the default. Sadly the view animations are done in private methods of StackView so nothing you can do about that either.
You're better of creating your own class that does this, and you can reference the code used in the StackView source. Creating such a class could be a lot of work and it's definitely not in the scope of a single question.

How to fully replace listView/GridView with RecyclerView?

I've noticed that the new RecyclerView class, even though it makes things a bit cleaner, is lacking a lot of functionality that I'm familiar with:
dividers, but this can be solved by looking at this post or this one
"footerDividersEnabled"
"headerDividersEnabled"
"listSelector" , but maybe I should simply set it per view ?
"fastScrollEnabled"
"smoothScrollbar"
"textFilterEnabled"
I've also tried to find out if there is a new way to use the new class with filtering (as done with ListView by implementing Filterable). I couldn't find out if there is such a thing
"tools:listitem" , to show the items on the UI designer.
Those are what I use, but maybe there are others that I missed.
Is there any tutorial or some guidelines of how to replace each of those things?
ok, I think I've found some solutions to what I wrote about:
dividers - the links I've given can probably help (here, here and here).
"footerDividersEnabled" - probably like #1, but even if you don't have it, you could always add a divider to the layout of the footer.
"headerDividersEnabled" - same as #2.
"listSelector" - should be done to the item views .
"fastScrollEnabled" - no solution is available for this, except for this library I've found, which was an answer for my post here.
"smoothScrollbar" - should be a feature request for #5. I think it's already smooth, but I'm not sure.
"textFilterEnabled" - sadly, you need to handle it yourself. create a thread pool of size 1, or manage your own thread (or use AsyncTask, in case the work is relatively short), and let it do the filtering for you.
Filterable - same as #7
"tools:listitem" - not available, but I think you could extend from RecyclerView and add it. You will however have to put some work, as RecyclerView doesn't know how to layout the views.
No tutorials that I know of, but the sources for ListView are public! There's no better way to learn than this... For example: I recently implemented filtering just like ListView does and it work like a charm. Plus, if you do it well, you only need to do it once and can re-apply it everywhere!
I would recommend you go look at some of the library's for the RecyclerView. You can find a lot of library's at https://android-arsenal.com/.
Also you can implement your own functionality in the RecyclerView and the Adapter for the RecyclerView. Just extend the RecyclerView and build on that.
I recommend that you read the source code for the RecyclerView at https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java.

Create Carousel Style ViewPager

I'm looking to try and implement this style pattern into my application:
http://www.androidpatterns.com/uap_pattern/carousel
But I am having trouble in finding an existing library or solution to it. Does anybody know of any libraries that I could use or how I would go about implementing this?
So far, Ive found this:
http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html
but it isn't quite what I want as it would be nice if it was hosted inside of a ViewPager so I can have buttons etc inside the view.
You might try twoway-view, an implementation of an AdapterView (similar to ListView/GridView) that supports horizontal scrolling.
In this case, you'd use it more like a ListView rather than a ViewPager, so each element would be a separate item layout, rather than Fragment.
One example of where twoway-view is in use right now is the latest Firefox for Android nightly as discussed on the announcement post, which contains some screenshots of it in use:

Implementing swiping between different views

I've been updating an Android app today which so far had a single TableLayout-based View. Now, I'd like to duplicate that View with another set of backing data, and use horizontal swiping to switch between both. At some point I'd also like to add a third "page" with a different TableLayout.
I haven't really found any good ways to get this going. I've been looking at http://developer.android.com/training/implementing-navigation/lateral.html, and I actually copied the code fragment for the Tabs Pattern with NAVIGATION_MODE_TABS. That results in a little dropdown widget being added to the View title in the action bar, but clicking it doesn't show the tabs I set up (with actionBar.addTab()). I'm also not sure how to set up the view (XML) code to stick the TableLayouts in there.
I should mention that I don't have to care for pre-4.0 Android for this, so compatibility is not (much of) an issue.
Try to Use ViewPager Widget you can find useful links on the web, this widget handle the horizontal swiping between views.
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
https://github.com/JakeWharton/Android-ViewPagerIndicator
http://blog.stylingandroid.com/archives/537#
I haven't really found any good ways to get this going.
Try ViewPager. Here is an Android Developers Blog post on ViewPager: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
Here is a small sample app using ViewPager: https://github.com/commonsguy/cw-omnibus/tree/master/ViewPager/Fragments
None of the other answers ended up helping much. However, this one is pretty good:
http://thepseudocoder.wordpress.com/2011/10/05/android-page-swiping-using-viewpager/

Categories

Resources