I wanted to ask can I implement pull-down refresh option on a linear layout control, I have read this & other examples also but they all are for "ListView" control.
#MH
Have a look at Chris Banes' pull-to-refresh implementation, which is available for several views, including ListView, GridView, ScrollView and WebView. You might be able to simple use the ScrollView version and wrap that around your LinearLayout. Alternatively it should be relatively easy to implement your own using the building blocks in that library.
This Worked for me.
Related
I am starting to delve into Android Development and there is a lot of material online. The question is... What are the pro's and con's against the drag and drop XML design method vs coding the view manually? The only reason I ask on here is because online the views are mixed and they don't really back up what they're defending.
If I use the drag and drop method will I have issues further onto my development adventures? That is the thing that worries me the most... I don't want to learn the drag and drop method and then editting the XML to cater for my needs and then be handicapped by it.
For the beginner(s), I highly recommend not to use Drag and drop. We need to understand XML, to be comfortable with android widget. Understanding XML will come handy in future when creating custom styles and themes.
Here are few pointers before you dive in android XML layout
Try sticking with match_parent and wrap_content while defining android:layout_height or android:layout_width if possible
Make sure you have good understanding of RelativeLayout, LinearLayout and FrameLayout and how its child views are arranged.
Forget about ConstraintLayout, AppbarLayout and similar advance layout at current.
Try exploring TextView, EditText, Button, ImageView and ProressBar as far as possible.(This are most common widgets/views)
Try avoiding any tutorial related to ListView, its deprecated. Try using RecyclerView instead, it is one of the important widget that would be used in regular basis.
This is in a lot of apps, where there is header content a view pager and then the pager content. The header content can scroll off the top then the pager content docks and continues to be able to scroll. I've tried a couple ways of doing this, I had the most success with using NestedScrollView, but I was never able to get fling and a few other use cases working right. As far as I can tell the apps that do this all spin their own solution.
I'm looking for suggestions on how to go about building this type of ui. Below is Google+ which uses this ui.
This is not exactly an answer (the question itself is quite open-ended) but I found cheesesquare implementation by Chris Banes (he's from the android team i think) very helpful with what you're asking.
https://github.com/chrisbanes/cheesesquare
What dejavu86 has said. The app in question is a demo of Design Support Library which has the UI widget, CollapsingToolbarLayout, which you are asking about.
http://android-developers.blogspot.co.uk/2015/05/android-design-support-library.html
I want to develop a layout with a very simple ImageView and a Listview binded in a Relativelayout . Now for a better user experience I want to delete the Image view by swiping it left or right same like what is implemented in android Gmail app to delete emails.
Implementing it on a listview item is very simple and there are many tuts and sample codes are available over the internet including the official Google I/O talk on animation and explained in a very good way by Chet Hasse here
https://www.youtube.com/watch?v=YCHNAi9kJI4
but I don't require to implement it on the listview items insted I want to implement it in more generic way. In my case I want the same behaviour for my ImageView item as one view and ListView another . Like shown below
As soon as the ImageView item is deleted the whole ListView should smoothly come on the top.
I have tried many way to implement the same without any success.
Suggest me the approach or some samples to do this which is supported in Gingerbread and above android OS.
You can use this code:
https://github.com/romannurik/Android-SwipeToDismiss/blob/master/src/com/example/android/swipedismiss/SwipeDismissTouchListener.java
As described in readme this code works for android 14+.
You can use the NineOldAndroids library to support old versions of Android, or use the Jake Wharton's port:
https://github.com/JakeWharton/SwipeToDismissNOA
I looked around and found this helpful.
https://github.com/nhaarman/ListViewAnimations
I implemented a custom ViewGroup that takes one child and allows you to drag/fling it to the left with a callback once the swipe is complete. My intention was for it to work just like in a RecyclerView. Works well in a LinearLayout with animateLayoutChanges=true and setting the visibility to GONE in the callback.
Gist here: https://gist.github.com/darnmason/38a1a5178a06470202784050f4dc1cdf
All you need is this library: https://github.com/timroes/EnhancedListView
I would like to build a specific layout for an android application. Actually, I would like to obtain something with the same behavior as inline-block div in html/css... I don't really know if I should use a LinearLayout or a GridLayout or something else...
It's like a horizontal LinearLayout but when the line is full, I would like my objects to go on the next line... I'm going to add the items programmatically to the container...
Here's an example of what I would like to do:
Do you have any idea?
Thanks by advance,
Valentin
Instead of using a layout, it might be easier to use a GridView because they will only use memory for items on screen and can be added using an adapter.
Read more here: http://developer.android.com/guide/topics/ui/layout/gridview.html
Android provides a GridLayout component (along with the helper view Space which can be used to build a flexible layout with multiple rows and columns, as explained in The Android Developers Blog. It is available as of Ice Cream Sandwich (v14) or as part of the v7 support library, and hence available to all 2.1+ devices.
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: