|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.support.v4.view.ViewCompat
public class ViewCompat
Helper for accessing features in View introduced after API
level 4 in a backwards compatible fashion.
| Field Summary | |
|---|---|
static int |
OVER_SCROLL_ALWAYS
Always allow a user to over-scroll this view, provided it is a view that can scroll. |
static int |
OVER_SCROLL_IF_CONTENT_SCROLLS
Allow a user to over-scroll this view only if the content is large enough to meaningfully scroll, provided it is a view that can scroll. |
static int |
OVER_SCROLL_NEVER
Never allow a user to over-scroll this view. |
| Constructor Summary | |
|---|---|
ViewCompat()
|
|
| Method Summary | |
|---|---|
static boolean |
canScrollHorizontally(android.view.View v,
int direction)
Check if this view can be scrolled horizontally in a certain direction. |
static boolean |
canScrollVertically(android.view.View v,
int direction)
Check if this view can be scrolled vertically in a certain direction. |
static int |
getOverScrollMode(android.view.View v)
Returns the over-scroll mode for this view. |
static void |
onInitializeAccessibilityEvent(android.view.View v,
android.view.accessibility.AccessibilityEvent event)
Initializes an AccessibilityEvent with information about
this View which is the event source. |
static void |
onInitializeAccessibilityNodeInfo(android.view.View v,
AccessibilityNodeInfoCompat info)
Initializes an AccessibilityNodeInfo with information
about this view. |
static void |
onPopulateAccessibilityEvent(android.view.View v,
android.view.accessibility.AccessibilityEvent event)
Called from View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)
giving a chance to this View to populate the accessibility event with its
text content. |
static void |
setAccessibilityDelegate(android.view.View v,
AccessibilityDelegateCompat delegate)
Sets a delegate for implementing accessibility support via compositon as opposed to inheritance. |
static void |
setOverScrollMode(android.view.View v,
int overScrollMode)
Set the over-scroll mode for this view. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int OVER_SCROLL_ALWAYS
public static final int OVER_SCROLL_IF_CONTENT_SCROLLS
public static final int OVER_SCROLL_NEVER
| Constructor Detail |
|---|
public ViewCompat()
| Method Detail |
|---|
public static boolean canScrollHorizontally(android.view.View v,
int direction)
v - The View against which to invoke the method.direction - Negative to check scrolling left, positive to check scrolling right.
public static boolean canScrollVertically(android.view.View v,
int direction)
v - The View against which to invoke the method.direction - Negative to check scrolling up, positive to check scrolling down.
public static int getOverScrollMode(android.view.View v)
OVER_SCROLL_ALWAYS (default), OVER_SCROLL_IF_CONTENT_SCROLLS
(allow over-scrolling only if the view content is larger than the container),
or OVER_SCROLL_NEVER.
v - The View against which to invoke the method.
public static void setOverScrollMode(android.view.View v,
int overScrollMode)
OVER_SCROLL_ALWAYS (default), OVER_SCROLL_IF_CONTENT_SCROLLS
(allow over-scrolling only if the view content is larger than the container),
or OVER_SCROLL_NEVER.
Setting the over-scroll mode of a view will have an effect only if the
view is capable of scrolling.
v - The View against which to invoke the method.overScrollMode - The new over-scroll mode for this view.
public static void onPopulateAccessibilityEvent(android.view.View v,
android.view.accessibility.AccessibilityEvent event)
View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)
giving a chance to this View to populate the accessibility event with its
text content. While this method is free to modify event
attributes other than text content, doing so should normally be performed in
View.onInitializeAccessibilityEvent(AccessibilityEvent).
Example: Adding formatted date string to an accessibility event in addition to the text added by the super implementation:
public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
super.onPopulateAccessibilityEvent(event);
final int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY;
String selectedDateUtterance = DateUtils.formatDateTime(mContext,
mCurrentDate.getTimeInMillis(), flags);
event.getText().add(selectedDateUtterance);
}
If an View.AccessibilityDelegate has been specified via calling
View.setAccessibilityDelegate(android.view.View.AccessibilityDelegate) its
View.AccessibilityDelegate.onPopulateAccessibilityEvent(View,
AccessibilityEvent)
is responsible for handling this call.
Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.
v - The View against which to invoke the method.event - The accessibility event which to populate.View.sendAccessibilityEvent(int),
View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)
public static void onInitializeAccessibilityEvent(android.view.View v,
android.view.accessibility.AccessibilityEvent event)
AccessibilityEvent with information about
this View which is the event source. In other words, the source of
an accessibility event is the view whose state change triggered firing
the event.
Example: Setting the password property of an event in addition to properties set by the super implementation:
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
event.setPassword(true);
}
If an View.AccessibilityDelegate has been specified via calling
View.setAccessibilityDelegate(android.view.View.AccessibilityDelegate) its
View.AccessibilityDelegate.onInitializeAccessibilityEvent(View,
AccessibilityEvent)
is responsible for handling this call.
Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.
v - The View against which to invoke the method.event - The event to initialize.View.sendAccessibilityEvent(int),
View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)
public static void onInitializeAccessibilityNodeInfo(android.view.View v,
AccessibilityNodeInfoCompat info)
AccessibilityNodeInfo with information
about this view. The base implementation sets:
AccessibilityNodeInfo.setParent(View),AccessibilityNodeInfo.setBoundsInParent(Rect),AccessibilityNodeInfo.setBoundsInScreen(Rect),AccessibilityNodeInfo.setPackageName(CharSequence),AccessibilityNodeInfo.setClassName(CharSequence),AccessibilityNodeInfo.setContentDescription(CharSequence),AccessibilityNodeInfo.setEnabled(boolean),AccessibilityNodeInfo.setClickable(boolean),AccessibilityNodeInfo.setFocusable(boolean),AccessibilityNodeInfo.setFocused(boolean),AccessibilityNodeInfo.setLongClickable(boolean),AccessibilityNodeInfo.setSelected(boolean),Subclasses should override this method, call the super implementation, and set additional attributes.
If an View.AccessibilityDelegate has been specified via calling
View.setAccessibilityDelegate(android.view.View.AccessibilityDelegate) its
View.AccessibilityDelegate.onInitializeAccessibilityNodeInfo(View,
android.view.accessibility.AccessibilityNodeInfo)
is responsible for handling this call.
v - The View against which to invoke the method.info - The instance to initialize.
public static void setAccessibilityDelegate(android.view.View v,
AccessibilityDelegateCompat delegate)
View.AccessibilityDelegate.
v - The View against which to invoke the method.delegate - The delegate instance.View.AccessibilityDelegate
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||