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.
Related
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.
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.
I am looking for a way to create a short overlay intro of an app to display to first time users. These posts gave me some understanding of how it can be done, but not entirely:
How do I create a help overlay like you see in a few Android apps and ICS?
How to use LayoutInflater / ViewStub for an overlay
I do not understand how to access my elements correctly, since my root layout element is a LinearLayout that includes an Actionbar and a ViewPager instead of containing actual elements.
Are there any frameworks that does this for you?
I think that this library : ShowcaseView is your best option.
As its name implies, it allows you to recreate the Android 4.x showcase view; ie :
.
The documentation of the project explains how to implement it.
Word of advice though : this kind of explanation view is viewed as bad design most of the time : if your application is well designed, you don't need to provide a tutorial to the user, it is supposed to be intuitive.
It can be totally justified in some cases of course, just be sure that :
-your users really need a tutorial.
-it is not because you are doing something opposite to the Android convetions.
Have a look at MaterialShowcaseView. It inherits from ShowcaseView and is up-to-date.
I am currently trying to get the look of my app right. But I am having problems figuring out how to even set up a way to change themes. For one thing, is there even a way to change styles through code? I checked the method list and I saw nothing. This leads me to my actual question; is there a way that, like CSS, in which you style the parent, and then have it trickle down but also changed depending on the View? I looked at the Android docs, and they did not show any examples of this. Hopefully someone can give me an idea as to how to accomplish this, or if its not possible, to let me know that as well. Thanks in advance.
You should be able to do this using styles and themes. I've implemented this using Jake whartons Sherlock action bar. (I'm not certain if it's necessary) It involves using the comparability library which gives you the ability to use fragments and loaders as well. Look at his democode at http://actionbarsherlock.com/download.html. Look for where themes are mentioned and you will find the information you need. In the demo app you can change the theme in the top right corner and see how it affects the activities look and feel. It also shows many of the features available and the code to write them. I have found this an invaluable resource and it should show you how to theme your app.
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/