語言

View.GetLocationInWindow(Int32[]) 方法

定義

取得該視圖在包含該視圖的視窗座標空間中的座標,無論系統裝飾如何。

[Android.Runtime.Register("getLocationInWindow", "([I)V", "GetGetLocationInWindow_arrayIHandler")]
public virtual void GetLocationInWindow(int[]? outLocation);
[<Android.Runtime.Register("getLocationInWindow", "([I)V", "GetGetLocationInWindow_arrayIHandler")>]
abstract member GetLocationInWindow : int[] -> unit
override this.GetLocationInWindow : int[] -> unit

參數

outLocation
Int32[]

一個兩元素整數陣列,儲存視圖座標。 x 座標位於索引 0;y座標,位於索引1。

屬性

備註

取得該視圖在包含該視圖的視窗座標空間中的座標,無論系統裝飾如何。

在多視窗模式下,座標空間的原點是包含該視圖視窗的左上角。 在全螢幕模式下,原點是裝置螢幕的左上角。

在多螢幕情境中,若應用程式跨越多個螢幕,座標空間也會跨越多個螢幕。 但如果應用程式只能在單一畫面,座標空間只會包含應用程式執行的畫面。

方法回傳後,參數陣列會包含視圖相對於視圖左側和上邊的 x 和 y 座標。

的 android.view.View.getLocationInWindow(int[])Java 檔。

此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。

適用於