com.xrigau.syncscrolling.view
Class EnhancedScrollView

java.lang.Object
  extended by ScrollView
      extended by com.xrigau.syncscrolling.view.EnhancedScrollView

public class EnhancedScrollView
extends ScrollView

Extension of a ScrollView that you should use to contain one or more SynchronizedRelativeLayout. This class overrides View#onScrollChanged() to notify scroll changes to a list of OnScrollChangedListener. This allows you having one or more SynchronizedRelativeLayout child views. As an ScrollView can only have one direct child, if you want to have more than one SynchronizedLayout, you should use a layout to contain them. This is how you can use it with one SynchronizedRelativeLayout. Nothing different from a ScrollView:

 <com.xrigau.syncscrolling.view.EnhancedScrollView
         android:fadingEdge="none"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content" >
 
         <com.xrigau.syncscrolling.view.SynchronizedRelativeLayout
             ... your stuff... >
             ... your views...
         </com.xrigau.syncscrolling.view.SynchronizedRelativeLayout>
     </com.xrigau.syncscrolling.view.EnhancedScrollView>
 
 

In case that you want to have two (or more), your xml should look similar to this:

 <com.xrigau.syncscrolling.view.EnhancedScrollView
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:fadingEdge="none" >
 
         <LinearLayout
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical" >
 
             <com.xrigau.syncscrolling.view.SynchronizedRelativeLayout
                 ...your stuff... >
                 ... your views...
             </com.xrigau.syncscrolling.view.SynchronizedRelativeLayout>
 
             <com.xrigau.syncscrolling.view.SynchronizedRelativeLayout
                 ...other stuff... >
                 ... other views...
             </com.xrigau.syncscrolling.view.SynchronizedRelativeLayout>
         </LinearLayout>
     </com.xrigau.syncscrolling.view.EnhancedScrollView>
 

Fore more code, take a look at SynchronizedRelativeLayout's Javadoc.

Version:
1.0.0
Author:
Xavi Rigau

Constructor Summary
EnhancedScrollView(Context context)
           
EnhancedScrollView(Context context, AttributeSet attrs)
           
EnhancedScrollView(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 void addOnScrollListener(com.xrigau.syncscrolling.view.EnhancedScrollView.OnScrollChangedListener onScrollListener)
           
protected  void onScrollChanged(int l, int t, int oldl, int oldt)
           
protected  void onSizeChanged(int w, int h, int oldw, int oldh)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnhancedScrollView

public EnhancedScrollView(Context context,
                          AttributeSet attrs,
                          int defStyle)

EnhancedScrollView

public EnhancedScrollView(Context context,
                          AttributeSet attrs)

EnhancedScrollView

public EnhancedScrollView(Context context)
Method Detail

onScrollChanged

protected void onScrollChanged(int l,
                               int t,
                               int oldl,
                               int oldt)

onSizeChanged

protected void onSizeChanged(int w,
                             int h,
                             int oldw,
                             int oldh)

addOnScrollListener

public void addOnScrollListener(com.xrigau.syncscrolling.view.EnhancedScrollView.OnScrollChangedListener onScrollListener)