当前位置:网站首页>Getlocationinwindow source code
Getlocationinwindow source code
2022-06-24 03:37:00 【Zhaojian ZJ】
/** * <p>Computes the coordinates of this view in its window. The argument * must be an array of two integers. After the method returns, the array * contains the x and y location in that order.</p> * * @param outLocation an array of two integers in which to hold the coordinates */
public void getLocationInWindow(@Size(2) int[] outLocation) {
if (outLocation == null || outLocation.length < 2) {
throw new IllegalArgumentException("outLocation must be an array of two integers");
}
outLocation[0] = 0;
outLocation[1] = 0;
transformFromViewToWindowSpace(outLocation);
}
public void transformFromViewToWindowSpace(@Size(2) int[] inOutLocation) {
if (inOutLocation == null || inOutLocation.length < 2) {
throw new IllegalArgumentException("inOutLocation must be an array of two integers");
}
if (mAttachInfo == null) {
// When the view is not attached to a window, this method does not make sense
inOutLocation[0] = inOutLocation[1] = 0;
return;
}
float position[] = mAttachInfo.mTmpTransformLocation;
position[0] = inOutLocation[0];
position[1] = inOutLocation[1];
if (!hasIdentityMatrix()) {
getMatrix().mapPoints(position);
}
position[0] += mLeft;
position[1] += mTop;
ViewParent viewParent = mParent;
while (viewParent instanceof View) {
final View view = (View) viewParent;
position[0] -= view.mScrollX;
position[1] -= view.mScrollY;
if (!view.hasIdentityMatrix()) {
view.getMatrix().mapPoints(position);
}
position[0] += view.mLeft;
position[1] += view.mTop;
viewParent = view.mParent;
}
if (viewParent instanceof ViewRootImpl) {
// *cough*
final ViewRootImpl vr = (ViewRootImpl) viewParent;
position[1] -= vr.mCurScrollY;
}
inOutLocation[0] = Math.round(position[0]);
inOutLocation[1] = Math.round(position[1]);
}
边栏推荐
- Use Charles to capture the package of the applet through the mobile agent
- The request was aborted: Could not create SSL/TLS secure channel.
- What is the fortress machine? What role does the fortress machine play?
- Build a small program + management background in 7 days, and this goose factory HR is blessed!
- What port does the fortress machine use? What is the role of the fortress machine?
- Coding Ci of Devops
- Disk partition extension using graphical interface and PowerShell code
- Summary of rust high concurrency programming
- 内存泄漏之KOOM
- Summary of common problems of real-time audio and video TRTC - quality
猜你喜欢

老弹出explorer.exe遇到问题已停止工作,怎么办?

Sorting out of key vulnerabilities identified by CMS in the peripheral management of red team (I)

内存泄漏之KOOM

元气森林推“有矿”,农夫山泉们跟着“卷”?

Ar 3D map technology

On Sunday, I rolled up the uni app "uview excellent UI framework"

ModStartCMS 企业内容建站系统(支持 Laravel9)v4.2.0

ModStartCMS 主题入门开发教程

浅谈游戏安全 (一)
Thank you for your recognition! One thank-you note after another
随机推荐
Micro build low code enterprise exchange day · Shenzhen station opens registration
Summary of common problems of real-time audio and video TRTC - quality
Sorting out of key vulnerabilities identified by CMS in the peripheral management of red team (I)
Why can't the fortress machine open the port? There is a problem with the use of the fortress machine port
Under what circumstances do you need a fortress machine? What are the functions of a fortress machine
Actual combat | how to use micro build low code to realize tolerance application
RPM 包的构建 - SPEC 基础知识
How to bypass CDN to get web pages? How many options are available?
Record a programming contest
4. go deep into tidb: detailed explanation of the implementation process of the implementation plan
web渗透测试----5、暴力破解漏洞--(2)SNMP密码破解
左滑从小窗到大窗口DispatchFrameLayout
Cross platform RDP protocol, RDP like protocol and non RDP protocol remote software
Pits encountered in refactoring code (1)
ModStartCMS 主题入门开发教程
你了解TLS协议吗?
How to apply for trademark registration? What are the steps?
What is the price of the elastic public network IP bandwidth
Does the user need a code signing certificate? What is the use of a code signing certificate
在pycharm中pytorch的安装