|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectRelativeLayout
com.xrigau.syncscrolling.view.SynchronizedRelativeLayout
public class SynchronizedRelativeLayout
Manages the vertical synchronized scrolling of a view in an
EnhancedScrollView
. This class is an extension of
RelativeLayout
.
There's a really good article that I've based on to create this library, you can find it at Kirill Grouchnikov's blog. The basics is that we'll have the sync view (the one that will scroll or stay on top of the screen, depending of the scroll position) and a placeholder (the dummy view) that will keep the space in your layout. The sync view will be like floating sometimes over the dummy view and sometimes will be on top of the screen, depending on the user scroll.
You must place at least two views inside a SynchronizedRelativeLayout:
This class can only be used from XML inflation.So you must declare both
the synchronizedView and the placeholderView attributes in your layout when
you use this class or you'll get an IllegalArgumentException
. That
attributes must refer to valid id's of views that exist inside this
SynchronizedRelativeLayout.
In addition, this class must be directly or indirectly contained by an
EnhancedScrollView
always, but you can have more than one.
There's an example of how to use an SynchronizedRelativeLayout:
<com.xrigau.syncscrolling.view.EnhancedScrollView android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="wrap_content" > <com.xrigau.syncscrolling.view.SynchronizedRelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" xrigau:placeholderView="@+id/base_view" xrigau:synchronizedView="@+id/synchronized_view" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <View android:layout_width="fill_parent" android:layout_height="100dip" android:background="#00ff00" /> <!-- This is the dummy placeholder that will keep space for the synchronized view. --> <View android:id="@+id/base_view" android:layout_width="fill_parent" android:layout_height="0dp" /> <View android:layout_width="fill_parent" android:layout_height="1000dip" android:background="#00ff00" /> </LinearLayout> <!-- This is the the synchronized view that will be put over the dummy placeholder and synchronized. --> <View android:id="@+id/synchronized_view" android:layout_width="fill_parent" android:layout_height="100dip" android:background="#ff0000" /> </com.xrigau.syncscrolling.view.SynchronizedRelativeLayout> </com.xrigau.syncscrolling.view.EnhancedScrollView>
Nested Class Summary | |
---|---|
static class |
SynchronizedRelativeLayout.Gravity
Static class containing the possible values that the syncView_layout attribute can have. |
Constructor Summary | |
---|---|
SynchronizedRelativeLayout(Context context,
AttributeSet attrs)
Constructor. |
|
SynchronizedRelativeLayout(Context context,
AttributeSet attrs,
int defStyle)
Constructor. |
Method Summary | |
---|---|
protected void |
onAttachedToWindow()
|
protected void |
onFinishInflate()
|
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b)
|
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
|
void |
onVerticalScrollChanged(int offsetY)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SynchronizedRelativeLayout(Context context, AttributeSet attrs, int defStyle)
Constructor.
context
- The context.attrs
- Some attrs.defStyle
- Style.public SynchronizedRelativeLayout(Context context, AttributeSet attrs)
Constructor.
context
- The context.attrs
- Some attrs.Method Detail |
---|
protected void onAttachedToWindow()
protected void onFinishInflate()
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
protected void onLayout(boolean changed, int l, int t, int r, int b)
public void onVerticalScrollChanged(int offsetY)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |