I want to scroll between views. Actually, I don't know what to use: HorizontalScrollView or Activities?
I want to slide between my layouts:
Am I need to implement GestureListener?
The problem with HorizontalScrollView is that I can't have more than 1 child.
Sounds like you're looking for a ViewPager, here's a description of them and a video of how it works - http://developer.android.com/training/animation/screen-slide.html
You'll have to use Fragments rather than Activities and if you want to do them on older versions of Android you'll need to use the support library.
you are looking for ViewPager, also have a look at this library
Related
In an android activity, I would like to have a view that can display different elements, sliding the screen like a carousel.
My question is what is the appropriate view for this work.
Horizontal ScrollView(http://developer.android.com/intl/es/reference/android/widget/HorizontalScrollView.html) is probably the simplest to implement, but I would suggest you to use a ViewPager (http://developer.android.com/intl/es/reference/android/support/v4/view/ViewPager.html)
Try ViewPager. This is the documentation http://developer.android.com/training/animation/screen-slide.html
Suppose I have a list of data to be displayed. I know how to display it using a ListView And it is very simple and easy to do it that way. But I am looking for an alternative way to achieve the same. I don't expect to have more than 20 items in the data set I am planning for.
I was thinking of a number of squares that the user can swipe to see the next one etc, similar to some widgets on home screen.
I came across android.widget.StackView, any advice available for this?
You can try StackView (http://developer.android.com/reference/android/widget/StackView.html).
This is how the Gallery and Youtube widgets are rendered.
ListView is the best option for listing lots of data. It has very efficient loading property. But if you do not want it any specific reason, you have to use ScrollView and in ScrollView, you have to place a LinearLayout and in that LinearLayout, you have to place multiple LinearLayout(for each items of data).
Maybe you can use a ViewPager (available also for lower versions of SDK through compatibility pack).
http://developer.android.com/training/implementing-navigation/lateral.html - see also the project example top right of the page : EffectiveNavigation.zip
You can use a GridView, if you want to show multiple items on a page in a different fashion than in ListView.
You can also use ViewPager (from android 3.0, or with the support library) with your custom views.
Is it possible to make HorizontalScrollView with snapping effects for each view inside it?
(Not gallery)
Nowdays you should use ViewPager or RecyclerView.
Old answer:
I used this one - http://www.dev-smart.com/archives/34
Very fast and compatible with lazy loading.
You try to use ViewPager instead
Have a look at below posts for sample codes. Still, most use ViewPager for the effect.
http://androidprogrammingmadeeasy.blogspot.jp/2011/08/creating-custom-horizontal-scroll-view.html
http://www.velir.com/blog/index.php/2010/11/17/android-snapping-horizontal-scroll/
I am looking for a behavior very similar to ios where we can scroll horizontally to see multiple pages (like a walkthrough/demo). In ios we can do it with UIScrollView and PageControl but not sure how can that be done in Android?
I don't mind if it's not possible to add the bullets of PageControl. I am more concerned about the pages type behavior of scrollview.
Take a look at this article on viewPager, I think it has the something as you require.
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
You can use ViewFlipper in android to scroll or swipe between the different layouts....
Try searching "android ViewFlipper onFling()" on google..
http://www.codeshogun.com/blog/tag/view-flipper/
I'm looking for a simple animation example using the android SDK for displaying a little animation between views.
Basically when we have a list view and a detail view - lets have a 'transition' animation between them.
Thanks
ViewSwitcher supports all kind of Animation and is very easy to use.
You can use overridePendingTransition on API 5 and above. Alternatively, you could have a ViewFlipper, with the detail and list activity in one.