|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFrameLayout
org.hermit.android.widgets.HScrollView
public class HScrollView
Layout container for a view hierarchy that can be scrolled by the user,
allowing it to be larger than the physical display. This class scrolls
horizontally, as opposed to android.widget.ScrollView
which
only supports vertical scrolling.
An HScrollView is a android.widget.FrameLayout
, meaning
you should place one child in it containing the entire contents
to scroll; this child may itself be a layout manager with a complex
hierarchy of objects. A child that is often used is a
android.widget.LinearLayout
in a vertical orientation, presenting
a vertical array of top-level items that the user can scroll through.
HScrollView only supports horizontally scrolling.
Constructor Summary | |
---|---|
HScrollView(Context context)
|
|
HScrollView(Context context,
AttributeSet attrs)
|
Method Summary | |
---|---|
void |
addView(View child)
|
void |
addView(View child,
int index)
|
void |
addView(View child,
int index,
ViewGroup.LayoutParams params)
|
void |
addView(View child,
ViewGroup.LayoutParams params)
|
boolean |
arrowScroll(int direction)
Handle scrolling in response to a left or right arrow click. |
protected int |
computeHorizontalScrollRange()
The scroll range of a scroll view is the overall height of all of its children. |
void |
computeScroll()
|
protected int |
computeScrollDeltaToGetChildRectOnScreen(Rect rect)
Compute the amount to scroll in the Y direction in order to get a rectangle completely on the screen (or, if taller than the screen, at least the first screen size chunk of it). |
boolean |
dispatchKeyEvent(KeyEvent event)
|
boolean |
executeKeyEvent(KeyEvent event)
You can call this function yourself to have the scroll view perform scrolling from a key event, just as if the event had been dispatched to it by the view hierarchy. |
void |
fling(int velocityX)
Fling the scroll view |
protected float |
getLeftFadingEdgeStrength()
|
int |
getMaxScrollAmount()
|
protected float |
getRightFadingEdgeStrength()
|
boolean |
isFillViewport()
Indicates whether this ScrollView's content is stretched to fill the viewport. |
boolean |
isSmoothScrollingEnabled()
|
protected void |
measureChild(View child,
int parentWidthMeasureSpec,
int parentHeightMeasureSpec)
|
protected void |
measureChildWithMargins(View child,
int parentWidthMeasureSpec,
int widthUsed,
int parentHeightMeasureSpec,
int heightUsed)
|
boolean |
onInterceptTouchEvent(MotionEvent ev)
|
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b)
|
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
|
protected boolean |
onRequestFocusInDescendants(int direction,
Rect previouslyFocusedRect)
When looking for focus in children of a scroll view, need to be a little more careful not to give focus to something that is scrolled off screen. |
protected void |
onSizeChanged(int w,
int h,
int oldw,
int oldh)
|
boolean |
onTouchEvent(MotionEvent ev)
|
void |
requestChildFocus(View child,
View focused)
|
boolean |
requestChildRectangleOnScreen(View child,
Rect rectangle,
boolean immediate)
|
void |
requestLayout()
|
void |
scrollTo(int x,
int y)
|
void |
setFillViewport(boolean fillViewport)
Indicates this ScrollView whether it should stretch its content height to fill the viewport or not. |
void |
setSmoothScrollingEnabled(boolean smoothScrollingEnabled)
Set whether arrow scrolling will animate its transition. |
void |
smoothScrollBy(int dx,
int dy)
Like View#scrollBy , but scroll smoothly instead of immediately. |
void |
smoothScrollTo(int x,
int y)
Like scrollTo(int, int) , but scroll smoothly instead of immediately. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HScrollView(Context context)
public HScrollView(Context context, AttributeSet attrs)
Method Detail |
---|
protected float getLeftFadingEdgeStrength()
protected float getRightFadingEdgeStrength()
public int getMaxScrollAmount()
public void addView(View child)
public void addView(View child, int index)
public void addView(View child, ViewGroup.LayoutParams params)
public void addView(View child, int index, ViewGroup.LayoutParams params)
public boolean isFillViewport()
public void setFillViewport(boolean fillViewport)
fillViewport
- True to stretch the content's height to the viewport's
boundaries, false otherwise.public boolean isSmoothScrollingEnabled()
public void setSmoothScrollingEnabled(boolean smoothScrollingEnabled)
smoothScrollingEnabled
- whether arrow scrolling will animate its transitionprotected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
public boolean dispatchKeyEvent(KeyEvent event)
public boolean executeKeyEvent(KeyEvent event)
event
- The key event to execute.
public boolean onInterceptTouchEvent(MotionEvent ev)
public boolean onTouchEvent(MotionEvent ev)
public boolean arrowScroll(int direction)
direction
- The direction corresponding to the arrow key that was
pressed
public final void smoothScrollBy(int dx, int dy)
View#scrollBy
, but scroll smoothly instead of immediately.
dx
- the number of pixels to scroll by on the X axisdy
- the number of pixels to scroll by on the Y axispublic final void smoothScrollTo(int x, int y)
scrollTo(int, int)
, but scroll smoothly instead of immediately.
x
- the position where to scroll on the X axisy
- the position where to scroll on the Y axisprotected int computeHorizontalScrollRange()
The scroll range of a scroll view is the overall height of all of its children.
protected void measureChild(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec)
protected void measureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed)
public void computeScroll()
protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect)
rect
- The rect.
public void requestChildFocus(View child, View focused)
protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect)
android.view.ViewGroup
implementation, otherwise this behavior might have been made the default.
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate)
public void requestLayout()
protected void onLayout(boolean changed, int l, int t, int r, int b)
protected void onSizeChanged(int w, int h, int oldw, int oldh)
public void fling(int velocityX)
velocityX
- The initial velocity in the Y direction. Positive
numbers mean that the finger/curor is moving down the screen,
which means we want to scroll towards the top.public void scrollTo(int x, int y)
This version also clamps the scrolling to the bounds of our child.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |