本文整理汇总了C#中Android.Views.View.GetLocationOnScreen方法的典型用法代码示例。如果您正苦于以下问题:C# View.GetLocationOnScreen方法的具体用法?C# View.GetLocationOnScreen怎么用?C# View.GetLocationOnScreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Views.View
的用法示例。
在下文中一共展示了View.GetLocationOnScreen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateAnchorRect
private static Rect CalculateAnchorRect(View anchor)
{
var location = new int[2];
anchor.GetLocationOnScreen(location);
return new Rect(location[0], location[1], location[0] + anchor.Width, location[1] + anchor.Height);
}
示例2: getFrameForView
//********************************************************************
// STATIC METHODS
//********************************************************************
/**
* Get the Rect frame for a view (relative to the Window of the application)
* @param v The view to get the rect from
* @return The rect of the view, relative to the application window
*/
public static Rect getFrameForView (View v)
{
int[] location = new int [2];
v.GetLocationOnScreen (location);
Rect viewRect = new Rect (location [0], location [1], location [0] + v.Width, location [1] + v.Height);
return viewRect;
}
示例3: IsPointInsideView
private bool IsPointInsideView (float x, float y, View view)
{
var location = new int[2];
view.GetLocationOnScreen (location);
int viewX = location [0];
//point is inside view bounds
if (x > viewX && x < (viewX + view.Width)) {
return true;
}
return false;
}
示例4: GetAnchorRectangle
Rect GetAnchorRectangle(View view)
{
var location = new int[2];
view.GetLocationOnScreen(location);
var anchorRect = new Rect(location[0], location[1], location[0] + view.Width, location[1] + view.Height);
return anchorRect;
}