Uiscrollable mainly includes the following methods:
1. Fast scrolling
2. Get list child elements
3. Get and set maximum scroll count constant value
4. Sliding area calibration constants set and get
5. Previous and backward scrolling
6. Scroll to an Object
7. Set the scroll direction
Its main inheritance relationships are as follows:
The basic format for use is as follows:
Uiscrollable Object name = new Uiscrollable (new Uiselector (). Select object Condition)
The object name. Operation function
Methods for fast scrolling:
Example:
Uiscrollable listscrollable = new Uiscrollable (new Uiselector (). Scrollable (true));
Listscrollable.flingtoend (2); Slide only two times to the end
1.public Boolean flingbackward () quickly slide backwards in step 5
2.public Boolena Flingforward () quickly slide forward with step 5
3.public boolean flingtobeginning (int maxswipes) custom sweep count with step 5 fast swipe to open
4.public boolean flingtoend (int maxswipes) custom sweep count with step 5 fast swipe to end
Get list child elements:
Example:
Uiscrollable listscrollable = new Uiscrollable (new Uiselector (). Scrollable (true)); Gets the scrolling element object
UiObject chinamobileobject = listscrollable.getchildbydescription (new Uiselector (). ClassName (" Android.widget.TextView ")," 10086 ", false);
Chinamobileobject.clickandwaitfornewwindow (); Click to wait for the new interface to appear
1.public UiObject getchildbydescription (uiselector childpattern, String text, Boolean allowscrollsearch)
Whether scrolling lookups are allowed to get UIObject objects with uiselector conditions and text description conditions
2.public UiObject getchildbydescription (uiselector childpattern, String text)
Default scrolling Gets the UIObject object with uiselector condition and text description condition
3.public UiObject getchildbyinstance (uiselector childpattern, int instance)
Get a subset of uiselector conditions and then filter the elements you want from the sub-set (without scrolling)
4.public Getchildbytext (uiselector childpattern, String text, Boolean allowscrollsearch)
Whether to allow scrolling to get UIObject objects with uiselector conditions and text conditions
5.public Getchildbytext (uiselector childpattern, String text)
Default scrolling Gets the UIObject object with uiselector condition and text condition
Gets the method that sets the maximum number of scroll constant values:
Example:
Uiscrollable listscrollable = new Uiscrollable (new Uiselector (). Scrollable (true));
Listscrollable.setmaxsearchswipes (10);
Listscrollable.scrolltextintoview ("about tablet");
1.public int Getmaxsearchswipes ()
Gets the maximum number of slides during a search slip, with a default constant of 30
2.public uiscrollable setmaxsearchswipes (int swipes)
To set the maximum number of sweeps
Sliding area calibration constants set and get method:
The calibration constant refers to the offset at which the coordinates of the operation are sliding, to take the offset ratio.
Example:
int swipeareaadjuct = (int) (Rect.height () *getswipedeadzonepercentage ()); Calculate coordinate offset
Downx = Rect.centerx ();
DownY = Rect.top + swipeareaadjust;
UpX = Rect.centerx ();
Upy = Rect.bottom-swipeareaadjust;
1.public Double Getswipedeadzonepercentage ()
The default constant value is 0.1,10%
2.public uiscrollable setswipedeadzonepercentage (double swipedeadzonepercentage)
Sets the size of a part to be considered as a percentage of no contact area when sliding.
Ways to roll forward and backward:
Example:
Uiscrollable listscrollable = new Uiscrollable (new Uiselector (). Scrollable (true));
Listscrollable.scrollbackward (10); Scroll Backward
1.public boolean scrollbackward (int steps)
Custom Step Backward Slide
2.public Boolean Scrollbackward ()
Slide backward in default step 55
3.public Boolean Scrolldescriptionintoview (String text)
Swipe to the location of the description and try to keep it centered on the screen
4.public Boolean Scrollforward ()
Scroll forward with default step 55
5.public boolean scrollforward (int steps)
Custom Step forward scrolling
Methods for scrolling to an object:
Example:
Uiscrollable listscrollable = new Uiscrollable (new Uiselector (). Scrollable (true));
Listscrollable.scrolldescriptionintoview ("about tablet");
1.public boolean scrollIntoView (Uiselector)
Scroll to the location of the conditional element and try to keep it centered on the screen
2.public boolean scrollintoview (UiObject obj)
Scroll to the object's location and try to keep it centered on the screen
3.public Boolean Scrolltextintoview (String text)
Scroll to the location of the text object and try to keep it centered on the screen
4.public boolean scrolltobeginning (int maxswipes)
Scroll to start position
5.public boolean scrolltobeginning (int masswipes, int steps)
Custom sweep distance and step, scroll to start position
6.public boolean scrolltoend (int maxswipes, int steps)
Custom sweep distance and step, scroll to end position
7.public boolean scrolltoend (int maxswipes)
Custom sweep distance, scroll to end position
To set the scrolling direction:
Example:
Uiscrollable listscrollable = new Uiscrollable (new Uiselector (). Scrollable (true));
Listscrollable.setashorizontallist (); Set Horizontal scrolling
Listscrollable.scrollforward (); Scroll forward Once
Listscrollable.setasverticallist (); Set Up Portrait scrolling
Listscrollable.scrolltextintoview ("My favourite");
1.public uiscrollable setashorizontallist ()
Set the scrolling direction to scroll horizontally
2.public uiscrollable setasverticallist ()
Set the scrolling direction to scroll vertically
The above blog references from:
Http://wenku.baidu.com/view/90ea92e3240c844769eaeec5.html?re=view
Introduction to Android Automated Test Uiautomator--uiscrollable interface