Megosztás a következőn keresztül:


TextView.GetOffsetForPosition(Single, Single) Method

Definition

Get the character offset closest to the specified absolute position.

[Android.Runtime.Register("getOffsetForPosition", "(FF)I", "GetGetOffsetForPosition_FFHandler")]
public virtual int GetOffsetForPosition (float x, float y);
[<Android.Runtime.Register("getOffsetForPosition", "(FF)I", "GetGetOffsetForPosition_FFHandler")>]
abstract member GetOffsetForPosition : single * single -> int
override this.GetOffsetForPosition : single * single -> int

Parameters

x
Single

The horizontal absolute position of a point on screen

y
Single

The vertical absolute position of a point on screen

Returns

the character offset for the character whose position is closest to the specified position. Returns -1 if there is no layout.

Attributes

Remarks

Get the character offset closest to the specified absolute position. A typical use case is to pass the result of MotionEvent#getX() and MotionEvent#getY() to this method.

Java documentation for android.widget.TextView.getOffsetForPosition(float, float).

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