共用方式為


View.GetLocalVisibleRect(Rect) Method

Definition

Sets r to the coordinates of the non-clipped area of this view relative to the top left corner of the view.

[Android.Runtime.Register("getLocalVisibleRect", "(Landroid/graphics/Rect;)Z", "")]
public bool GetLocalVisibleRect (Android.Graphics.Rect? r);
[<Android.Runtime.Register("getLocalVisibleRect", "(Landroid/graphics/Rect;)Z", "")>]
member this.GetLocalVisibleRect : Android.Graphics.Rect -> bool

Parameters

r
Rect

If the method returns true, contains the coordinates of the visible portion of this view relative to the top left corner of the view. If the method returns false, the contents of r are undefined.

Returns

true if at least part of the view is visible; false if the view is completely clipped or translated out of the visible area.

Attributes

Remarks

Sets r to the coordinates of the non-clipped area of this view relative to the top left corner of the view.

If the view is clipped on the left or top, the left and top coordinates are offset from 0 by the clipped amount. For example, if the view is off screen 50px on the left and 30px at the top, the left and top coordinates are 50 and 30 respectively.

If the view is clipped on the right or bottom, the right and bottom coordinates are reduced by the clipped amount. For example, if the view is off screen 40px on the right and 20px at the bottom, the right coordinate is the view width - 40, and the bottom coordinate is the view height - 20.

Java documentation for android.view.View.getLocalVisibleRect(android.graphics.Rect).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to