Scrolling Functionality - android

I need to implement a UI like this:
In the above screen row needs to be scrolled horizontally and columns need to be scrolled vertically.
I have not used Gallery as It is being deprecated. Here are some scenarios which I have tried:
1. Combination of GridView and ListView.
2. Combination of ListView and Horizontal ListView(Custom Component).
Option 1 did not work for me but I could make it with option 2.
With option 2 perfomance is not good.
Solution: I am thinking of implementing 4-5 horizontal listviews inside scrollview with Gestures so that I can handle the vertical swipe thru code or by subclassing the ScrollView and overriding the onScrollChanged method.
But I am looking for some more optimized solution.
Any help is appreciated.
Thanks

Use webview and push the content into it through JS hooks.

I have gone with my solution if anyone can suggest a better solution then obviously I will go with it:
Solution:
Implemented 4-5 horizontal listviews inside scrollview with Gestures
and handled the vertical swipe thru code or by subclassing the
ScrollView and overriding the onScrollChanged method.

Related

Scroll another HorizontalScrollView though one is scrolling in android

I have two HorizontalScrollViews. If the user scrolls one ScrollView, the other ScrollView should also get scrolled. I am new to android and I wonder to know how can I achieve this?
If you want your two different scrollviews to scroll at the same time it means you only need one scroll view in which you cand put the content within the ones you have now. Try do make thinghs as simple as you can
Extend HorizontalScrollview like this: https://stackoverflow.com/a/6462630/1124160
onScroll in first ScrollView: http://developer.android.com/reference/android/widget/HorizontalScrollView.html#scrollTo(int, int)
Scroll the second one.
If your have number of items save in both HorizontalScrollView , then create a GridView and give number of columns equals to element in one HorizontalScrollView. In this way you can achieve your goal.

Android: I want to swipe between cells of a grid where only one cell is visible at a time

I want a single cell of a grid to take up my whole screen and swipe up/down/left/right to access other cells (not smoothly, but switch to the next cell). What do you think is a good way of implementing this?
I've partially implemented this in GridView and ListView containing a HorizontalListView and am considering TableLayout.
Any advice?
I would start with the DirectionalViewPager on github and try to modify it so that it can always swipe in any direction instead of having to call setOrientation(DirectionalViewPager.VERTICAL)and setOrientation(DirectionalViewPager.HORIZONTAL) I don't know exactly how much you'll have to modify it, but it is most of the way there, I would think that the change should be relatively straight forward.
How about you take a look at this. the horizontal paging(swipe views)

Android - Mulitple listeners on a single view with the ability to pass off events to other views

I have a Gallery that contains a ScrollView. I can scroll through the text in the ScrollView with a vertical swipe as is standard. However, I would like the ScrollView to also listen for horizontal swipes which would then move the Gallery left or right. Does anyone know how to do that?
Thanks.
Okay, here is what I found. You will need to use onInterceptTouchEvent(). You can read about it here: http://developer.android.com/reference/android/view/ViewGroup.html
Alternatively, you can do a search for onInterceptTouchEvent example to find several examples.

Android - How to determinate ViewFlipper children size when not displayed?

I'm actually making an application using a ViewFlipper to display 3 differents custom views. These views are, for each one, in a ScrollView (putting the ViewFlipper in a single ScrollView isn't making my onFling gestures really efficient). And i'm actually trying to synchronize the three Scrollbars position. At this point using a single ScrollView would have been easier but i trying to not use this solution.
I'm using a ScrollListener for each ScrollView to set the others ScrollView scroll position like in this thread : Synchronise ScrollView scroll positions - android.
The problem is that this method will works but the first time. When i'm on a ScrollView, the two others are not drawn already and their height is null. So setting their scroll position isn't working.
/*Instanciate ScollViews*/
scrollViewLeft = (ScrollableScrollView) findViewById(R.id.scroll_prev);
scrollViewCenter =(ScrollableScrollView) findViewById(R.id.scroll_current);
scrollViewRight = (ScrollableScrollView) findViewById(R.id.scroll_next);
/*Fill views with events*/
setDayEvents(calIns.getPrevCal(),leftDayView);
setDayEvents(calIns.getActualCal(),centerDayView);
setDayEvents(calIns.getNextCal(),rightDayView);
scrollViewLeft.setScrollViewListener(this);
scrollViewCenter.setScrollViewListener(this);
scrollViewRight.setScrollViewListener(this);
So finally my question is, should i use another method to find the scroll position of the two others views ? Or can i force the view to be drawn in a ViewFlipper ?
Thanks :)
Clement.
Try saving the positions in global variables before you change the views and then just apply it to your current view.
Thanks Egor for having answered. I think it is a good idea. I already have a Singleton to handle variables. So i add the variable position with getters and setters.
The probleme here is than even if I override the method "onSizeChanged" in my custom ScrollView, this will apply only for the first view shown.
PS: I'm still starting on Android development and I don't really know how to handle with
interactions on views when they aren't ready (for example getting width when they are not drawn yet).
Edit 1 day later :
Ok i found what was the problem, it is because the size of my views inside the scrollviews wasn't defined (the scrollview was drawn before the view inside it). So by setting the scroll inside the "onSizeChanged" method of the views works well.

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