共用方式為


AdapterView.GetPositionForView(View) Method

Definition

Returns the position within the adapter's data set for the view, where view is a an adapter item or a descendant of an adapter item.

[Android.Runtime.Register("getPositionForView", "(Landroid/view/View;)I", "GetGetPositionForView_Landroid_view_View_Handler")]
public virtual int GetPositionForView (Android.Views.View? view);
[<Android.Runtime.Register("getPositionForView", "(Landroid/view/View;)I", "GetGetPositionForView_Landroid_view_View_Handler")>]
abstract member GetPositionForView : Android.Views.View -> int
override this.GetPositionForView : Android.Views.View -> int

Parameters

view
View

an adapter item, or a descendant of an adapter item. This must be visible in this AdapterView at the time of the call.

Returns

the position within the adapter's data set of the view, or #INVALID_POSITION if the view does not correspond to a list item (or it is not currently visible)

Attributes

Remarks

Returns the position within the adapter's data set for the view, where view is a an adapter item or a descendant of an adapter item.

<strong>Note:</strong> The result of this method only reflects the position of the data bound to <var>view</var> during the most recent layout pass. If the adapter's data set has changed without a subsequent layout pass, the position returned by this method may not match the current position of the data within the adapter.

Java documentation for android.widget.AdapterView.getPositionForView(android.view.View).

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