|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.ui.Field
net.rim.device.api.ui.ScrollView
public abstract class ScrollView
This class provides fundamental scrolling functionality to all Managers.
This class is not intended to be directly subclassed by third party developers.
ScrollView is aware of horizontal and vertical scroll position and scroll boundaries, but not the content contained within. It provides a layer of abstraction between scrolling mechanics and rendering content. ScrollView can be used to get or modify the scroll position, with or without animation. Many helper methods are contained within, to execute common tasks associated with making a region visible or getting the state of scrolling.
ScrollView utilizes a horizontal and vertical Adjustment to encapsulate the state of each scrollable axis. The value of the Adjustment represents the current scroll position, in pixels, along that axis. Upper and lower values of the Adjustment are the scroll limits. Please note that bounce and elasticity animations allow the scroll position along each axis to temporarily move beyond the limits defined in the Adjustment. ScrollView will use pageSize on each Adjustment to divide it’s virtual area into a series of scrollable pages. PageStepSize will define the scroll threshold that mused be passed in order to move to the next page. StepSize from each Adjustment defines the amount of pixels scrolled, performed on a standard navigation movement.
Scroll paging, with ‘speed bump’ like animations can be enabled by setting values > 0 for pageSize and pageStepSize on the Adjustment representing the appropriate axis (horizontal or vertical).
Field Summary | ||
---|---|---|
static long |
HORIZONTAL_SCROLL
ScrollView style to turn on horizontal scrolling. |
|
static long |
HORIZONTAL_SCROLLBAR
ScrollView style to turn on horizontal scrollbars. |
|
protected static long |
HORIZONTAL_SCROLLBAR_MASK
Bitfield mask of the horizontal scrollbar style specifiers. |
|
protected static long |
HORIZONTAL_SCROLL_MASK
Bitfield mask of the horizontal scroll style specifiers. |
|
static long |
NO_HORIZONTAL_SCROLL
ScrollView will not support horizontal scrolling. |
|
static long |
NO_HORIZONTAL_SCROLLBAR
ScrollView will not show horizontal scrollbars. |
|
static long |
NO_SCROLL_RESET
Deprecated. |
|
static long |
NO_VERTICAL_SCROLL
ScrollView will not support vertical scrolling. |
|
static long |
NO_VERTICAL_SCROLLBAR
ScrollView will not show vertical scrollbars. |
|
static long |
VERTICAL_SCROLL
ScrollView style to turn on vertical scrolling. |
|
static long |
VERTICAL_SCROLLBAR
ScrollView style to turn on vertical scrollbars. |
|
protected static long |
VERTICAL_SCROLLBAR_MASK
Bitfield mask of the vertical scrollbar style specifiers. |
|
protected static long |
VERTICAL_SCROLL_MASK
Bitfield mask of the vertical scroll style specifiers. |
Method Summary | ||
---|---|---|
void |
configurationChanged(Adjustment a)
Called by Adjustment when the config changes. |
|
Adjustment |
getHorizontalAdjustment()
Get the Adjustment being used for horizontal scrolling. |
|
int |
getHorizontalScroll()
Returns current horizontal offset of scrolling region. |
|
Adjustment |
getVerticalAdjustment()
Get the Adjustment being used for vertical scrolling. |
|
int |
getVerticalScroll()
Retrieves current vertical offset of scrolling region. |
|
int |
getVirtualHeight()
Retrieves this ScrollView's virtual height. |
|
int |
getVirtualWidth()
Retrieves this ScrollView's virtual width. |
|
int |
getVisibleHeight()
Retrieves height of this ScrollView's visible region. |
|
int |
getVisibleWidth()
Retrieves width of this ScrollView's visible region. |
|
protected void |
onExposed()
Invoked when the screen this field is attached to is revealed by a screen getting popped off the display stack. |
|
void |
setCurrentLocation(int x,
int y)
Sets this ScrollView's current location. |
|
protected void |
setExtent(int width,
int height)
Sets this field's extent. |
|
void |
setHorizontalAdjustment(Adjustment a)
Set the Adjustment to be used for horizontal scrolling. |
|
void |
setHorizontalScroll(int position)
Sets this ScrollView's horizontal scroll value. |
|
void |
setHorizontalScroll(int position,
boolean animate)
Sets this ScrollView's horizontal scroll value. |
|
void |
setScrollListener(ScrollChangeListener listener)
Registers a listener for scroll changes. |
|
protected void |
setScrollingInertial(boolean isScrollingInertial)
Sets whether the scrolling on this ScrollView is inertial, overriding the system's default. |
|
void |
setVerticalAdjustment(Adjustment a)
Set the Adjustment to be used for vertical scrolling. |
|
void |
setVerticalScroll(int position)
Sets this ScrollView's vertical scroll value. |
|
void |
setVerticalScroll(int position,
boolean animate)
Sets this ScrollView's vertical scroll value. |
|
protected void |
setVirtualExtent(int virtualWidth,
int virtualHeight)
Sets the virtual extent for this ScrollView. |
|
void |
valueChanged(Adjustment a)
Called by Adjustment when the value changes. |
|
void |
waitForScrolling()
Waits until the view's engine has stopped scrolling, then returns. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long HORIZONTAL_SCROLL
If this scroll provider's virtual width is larger than its visible width the region scrolls horizontally as required.
protected static final long HORIZONTAL_SCROLL_MASK
public static final long HORIZONTAL_SCROLLBAR
Note: this functionality has been implemented only for scroll arrows.
If VERTICAL_SCROLL_BAR
is enabled then HORIZONTAL_SCROLL_BAR
is ignored.
protected static final long HORIZONTAL_SCROLLBAR_MASK
public static final long NO_HORIZONTAL_SCROLL
public static final long NO_HORIZONTAL_SCROLLBAR
public static final long NO_SCROLL_RESET
public static final long NO_VERTICAL_SCROLL
public static final long NO_VERTICAL_SCROLLBAR
public static final long VERTICAL_SCROLL
If the ScrollView's virtual height is larger than its visible height, the region scrolls vertically as required.
protected static final long VERTICAL_SCROLL_MASK
public static final long VERTICAL_SCROLLBAR
protected static final long VERTICAL_SCROLLBAR_MASK
Method Detail |
---|
public int getHorizontalScroll()
Invoke this method to retrieve the current offset (from the left edge of this ScrollView's virtual region) of the currently displayed part of the ScrollView.
public int getVerticalScroll()
Invoke this method to retrieve the current offset (from the top edge of this ScrollView's virtual region) of the currently displayed part of the ScrollView.
public int getVirtualHeight()
The ScrollView's virtual height is the entire height of the field that can be displayed, either at once or by scrolling.
public int getVirtualWidth()
The ScrollView's virtual width may be wider than the ScrollView's visible width, and can be displayed either all at once or by scrolling.
public int getVisibleHeight()
public int getVisibleWidth()
protected void onExposed()
The complementing callback is Field.onObscured()
.
onExposed
in class Field
protected void setExtent(int width, int height)
The field calls this method during layout to set its extent (height and width). Anything overriding this method should call super.setExtent(width,height).
setExtent
in class Field
width
- Width of the field.height
- Height of the field.public void setHorizontalScroll(int position)
Invoke this method to adjust the horizontal scroll value for this ScrollView. This method is not normally invoked as focus movement deals with scrolling automatically.
If you use this function to set the scroll value for a screen that is not on the display stack you must push the screen onto the stack first, before invoking this method.
position
- New horizontal scroll position.public void setHorizontalScroll(int position, boolean animate)
Invoke this method to adjust the horizontal scroll value for this ScrollView. This method is not normally invoked as focus movement deals with scrolling automatically.
If you use this function to set the scroll value for a screen that is not on the display stack you must push the screen onto the stack first, before invoking this method.
position
- New horizontal scroll position. Ignored if scrolling is not possible.animate
- Animate the scrolling if true, jump to the new scroll position if falseprotected void setScrollingInertial(boolean isScrollingInertial)
isScrollingInertial
- whether the scrolling for this ScrollView is "inertial", assuming that it is supported on this device.public void setScrollListener(ScrollChangeListener listener)
To unregister a scroll listener, pass null into this method.
listener
- Object that listens for scroll changes.
IllegalStateException
- when there is already a listener set and your listener parameter is non-null.public void setCurrentLocation(int x, int y)
Invoke this method to adjust the current location for this ScrollView. This method is not normally invoked as focus movement deals with scrolling automatically.
If you use this function to set the scroll value for a screen that is not on the display stack you must push the screen onto the stack first, before invoking this method.
x
- New horizontal scroll position.x
- New vertical scroll position.public void setVerticalScroll(int position)
Invoke this method to adjust the vertical scroll value for this ScrollView. This method is not normally invoked as focus movement deals with scrolling automatically.
If you use this function to set the scroll value for a screen that is not on the display stack you must push the screen onto the stack first, before invoking this method.
position
- New vertical scroll position.public void setVerticalScroll(int position, boolean animate)
Invoke this method to adjust the vertical scroll value for this ScrollView. This method is not normally invoked as focus movement deals with scrolling automatically.
If you use this function to set the scroll value for a screen that is not on the display stack you must push the screen onto the stack first, before invoking this method.
position
- New vertical scroll position. Ignored if scrolling is not possible.animate
- Animate the scrolling if true, jump to the new scroll position if falseprotected void setVirtualExtent(int virtualWidth, int virtualHeight)
Use this method to specify the size of the area that child controls inhabit. If this extent is larger than the ScrollView's visible area, scrolling is used to bring the extra area into view.
Subclasses should invoke this method when layout is called.
virtualWidth
- Width of the ScrollView's virtual extent.virtualHeight
- Height of the ScrollView's virtual extent.public void configurationChanged(Adjustment a)
configurationChanged
in interface AdjustmentListener
a
- source Adjustmentpublic void valueChanged(Adjustment a)
valueChanged
in interface AdjustmentListener
a
- source Adjustmentpublic void setHorizontalAdjustment(Adjustment a)
a
- Adjustment representing the horizontal axis. Use this object to modify scroll position,
boundaries, page sizes, page step size required to move to the next page, and step size used for nav
movement.public void setVerticalAdjustment(Adjustment a)
a
- Adjustment representing the vertical axis. Use this object to modify scroll position,
boundaries, page sizes, page step size required to move to the next page, and step size used for nav
movement.public Adjustment getHorizontalAdjustment()
public Adjustment getVerticalAdjustment()
public void waitForScrolling()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal