UIScrollable的基本講解

UiScrollable:可滾動的控件,如果操作的控件需要滾動就可以使用UiScrollable
    如:UiScrollable  appsList=new UiScrollable(new UiSelector().className("android.view.View"));
    appsList.setAsHorizontalList();

快速滾動 、獲取列表子元素、獲取或者設置滾動次數、向前向後滾動、設置水平垂直滾動方向、滾動到某個對象、滑動座標的偏移量。

Public  Constructors
UiScrollable(UiSelector container) 構造函數

Public Methods
boolean    flingBackward()
Performs a backwards fling action with the default number of fling steps (5).
boolean    flingForward()
Performs a forward fling with the default number of fling steps (5).
boolean    flingToBeginning(int maxSwipes)
Performs a fling gesture to reach the beginning of a scrollable layout element.
boolean    flingToEnd(int maxSwipes)
Performs a fling gesture to reach the end of a scrollable layout element.
UiObject    getChildByDescription(UiSelector childPattern, String text)
Searches for a child element in the present scrollable container.
UiObject    getChildByDescription(UiSelector childPattern, String text, boolean allowScrollSearch)
Searches for a child element in the present scrollable container.
UiObject    getChildByInstance(UiSelector childPattern, int instance)
Searches for a child element in the present scrollable container that matches the selector you provided.
UiObject    getChildByText(UiSelector childPattern, String text)
Searches for a child element in the present scrollable container.
UiObject    getChildByText(UiSelector childPattern, String text, boolean allowScrollSearch)
Searches for a child element in the present scrollable container.
int    getMaxSearchSwipes()
Gets the maximum number of scrolls allowed when performing a scroll action in search of a child element.
double    getSwipeDeadZonePercentage()
Returns the percentage of a widget's size that's considered as a no-touch zone when swiping.
boolean    scrollBackward(int steps)
Performs a backward scroll.
boolean    scrollBackward()
Performs a backward scroll with the default number of scroll steps (55).
boolean    scrollDescriptionIntoView(String text)
Performs a forward scroll action on the scrollable layout element until the content-description is found, or until swipe attempts have been exhausted.
boolean    scrollForward()
Performs a forward scroll with the default number of scroll steps (55).
boolean    scrollForward(int steps)
Performs a forward scroll.
boolean    scrollIntoView(UiSelector selector)
Perform a scroll forward action to move through the scrollable layout element until a visible item that matches the selector is found.
boolean    scrollIntoView(UiObject obj)
Perform a forward scroll action to move through the scrollable layout element until a visible item that matches the UiObject is found.
boolean    scrollTextIntoView(String text)
Performs a forward scroll action on the scrollable layout element until the text you provided is visible, or until swipe attempts have been exhausted.
boolean    scrollToBeginning(int maxSwipes)
Scrolls to the beginning of a scrollable layout element.
boolean    scrollToBeginning(int maxSwipes, int steps)
Scrolls to the beginning of a scrollable layout element.
boolean    scrollToEnd(int maxSwipes, int steps)
Scrolls to the end of a scrollable layout element.
boolean    scrollToEnd(int maxSwipes)
Scrolls to the end of a scrollable layout element.
UiScrollable    setAsHorizontalList()
Set the direction of swipes to be horizontal when performing scroll actions.
UiScrollable    setAsVerticalList()
Set the direction of swipes to be vertical when performing scroll actions.
UiScrollable    setMaxSearchSwipes(int swipes)
Sets the maximum number of scrolls allowed when performing a scroll action in search of a child element.
UiScrollable    setSwipeDeadZonePercentage(double swipeDeadZonePercentage)
Sets the percentage of a widget's size that's considered as no-touch zone when swiping.
Protected Methods
boolean    exists(UiSelector selector)
Used privately when performing swipe searches to decide if an element has become visible or not.


總結:
也即是對可以滾動的界面的一個滾動操作。

相應的官方鏈接:
http://developer.android.com/intl/zh-cn/reference/android/support/test/uiautomator/UiCollection.html




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章