How to use the slide navigation UI pattern with listview? - android

I'm using the new slide navigation UI pattern in my android app, yet it keeps crashing when I use it with a vertical listview. The listview listener on my main screen conflicts with the slide menu listener, which causes the crash when they both capture the motion events.
I know using two different listeners for motion events isn't recommended, yet many applications use it nowadays (like Youtube and Facebook). How did they manage to do it? Any useful libraries out there that can solve this issue?

If you want to implement list view on the main screen, you would do that using any of the ListViewAdapter. For implementing listView on the side screen when the view is slided you need to implement using ListFragment.
Also, you may refer example in https://github.com/jfeinstein10/SlidingMenu

Related

How to detect swipe gesture in mvvmcross

I am using mvvmcross pattern. I have a list of datasets. I am showing only one dataset on the view. When user swipes either left or right, then I need to reload the view to show corresponding dataset.
My dataset is big (around 100), I am afraid to use viewpager, it might be an issue in terms of memory.
I have used the following approach before Android: How to handle right to left swipe gestures, but I wonder how to detect/implement swipe gesture in mvvmcross ?
Swipe gestures are a View concern and are generally not implemented in a MVVM framework. MvvmCross has a Tap gesture recognizer for iOS only.
So since it is a View concern you should look at how this is done natively on Android.

ListView or ScrollView?

At the moment, I am using a ScrollView with a LinearLayout inside it. I want to implement a snap function. Am I better off using a ListView? Is it even possible to implement a snap function with my current setup? I want to keep things simple.
By "snap function" I am assuming that you mean paging so the user can swipe from side to side similar to the Play Store or the ICS Dialer apps. While yes, you can implement this yourself with a ScrollView, or any number of other solutions, I don't think you should because you can use Android's ViewPager class.
ViewPager is a wonderful view that uses a collection of Fragments as pages in a single layout. This will give your user a very familiar and consistent interface, and will save you a lot of very difficult code.

Google+ app listview layout with different views

I'm trying to implement a sliding menu just like the one found in Google's Google+ Android app:
I've got the actual sliding menu working but I'm having trouble implementing a scrolling view that can hold any type of child views.
For example I would like to have a header like the "NOTIFICATIONS" row in screenshot and below it a ListView with notification items. And I would like to have another sections below that list, perhaps called "ERRORS" and below it a different ListView with errors. And perhaps a WebView at the very bottom.
How is this best implemented?
Note: I have read this tutorial but it's talking about a single ListView. I would like to construct this using a LinearLayout or alike, if that's possible.
The way I ended up implementing this was with a ScrollView that I simply populated with Views.
There are some things to be considered when using a ScrollView, like this answer or the Android documentation.
From what I understand, if you need a whole lot of items in a list then you should look at using a ListView. Otherwise a ScrollView will do just fine.

View Flipping in Android using same activity

I am new to android therefore I got a little bit lost with all those ViewFlipper, ViewSwitcher, ViewAnimator and ViewPager. Moreover, I am not sure what's happening under the hood.
Basically I have an activity which shows some data. With swipe (or button, doesnt matter) I would like to scroll the view and get to another page (as seen in the picture below).
Is it possible to implement something like that without changing to another activity?
I am a little bit confused regarding views and access to the design elements. How those pages are located each to another? e.g. If I am currently seeing Page1, can I modify content of Page3? Or plainly saying, are all page views loaded all together? As if I set setContentView(R.layout.xlayout); then I can access only xlayout elements.
But if I use same activity, then I have a thread there which updates a counter on Page1, if I change view to Page 2, the counter will not find Page1 Counter TextView and will complain.
As I Understand Android 4.0 has ViewPager which is similar to the seen in the picture. I am using GB. Should I use support library or can I just go around and implement something similar without importing any libraries?
(Sorry, my description is a little bit messy)
Yes, you can use ViewSwitcher, ViewFlipper and ImageSwitcher depending on your requirements.
ViewSwitcher may have two childs at max. And these child might be a View or an object of subclass of view.
ViewFlipper: May have as many childs you want. and these child might be a View or an object of subclass of view.
ImageSwitcher might be used to switch images over.
By using view flipper you can display one item at a time, and adding a gesture overlay, you can apply sliding effect. To apply View Flipper, you need to add all the views to ViewFlipper, and showNext and showPrevious methods are used to show next and previous child.
You need to use a ViewPager to have the same behaviour as in Google Play.
it only available on recent version of Android, but you can use the Compatibility Package to make it available for older version.
With a ViewFlipper you can't "scroll" between two pages.

Change ListViewItems Layout with a Right Swipe. Android

i've now got the listview and it's touch actions and swipe actions working. But now i'm not sure how i can implement a swipe effect, like it's in the twitter app.
I've found in the internet that it's possible to animate 2 views with a viewflipper, but is it possible to animate two layouts in the same way?
Anyone out there, who knows how i can implement such a function?
The only thing i want is to switch the ListViewsItem layout with a swipe.
Simple, set both the item views in 2 separate thread and then start both of them.

Categories

Resources