当前位置:网站首页>getLocationInWindow源码
getLocationInWindow源码
2022-06-24 03:34:00 【赵健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]);
}
边栏推荐
- What is the maximum bandwidth of EIP? Mbps how to modify the bandwidth of EIP
- Lua language development, esp8266 access to Bafa cloud, mqtt and TCP protocols
- JD Logistics: from giant baby to mainstay
- Grpc: how to reasonably manage log configuration?
- Create a telepresence USB drive using the DD command
- Several key tools for cloud native implementation
- [summary of interview questions] zj6 redis
- How to query trademark registration? Where should I check?
- [see you] on October 24, we met at Tencent Binhai building
- Understanding Devops from the perspective of decision makers
猜你喜欢

Sorting out of key vulnerabilities identified by CMS in the peripheral management of red team (I)
Thank you for your recognition! One thank-you note after another
![[summary of interview questions] zj5](/img/d8/ece82f8b2479adb948ba706f6f5039.jpg)
[summary of interview questions] zj5

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

QT creator tips

Community pycharm installation visual database

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

618大促:手机品牌“神仙打架”,高端市场“谁主沉浮”?
![[summary of interview questions] zj6 redis](/img/4b/eadf66ca8d834f049f3546d348fa32.jpg)
[summary of interview questions] zj6 redis

Ar 3D map technology
随机推荐
The medical technology giant was blackmailed and Microsoft announced 74 security vulnerabilities | global network security hotspot
Summary of common SSH commands
Interpreting Tencent cloud product experience through user experience elements
Disk partition extension using graphical interface and PowerShell code
News | detailed explanation of network security vulnerabilities of branch enterprises
Summary of rust high concurrency programming
Windowsvpn client is coveted by vulnerabilities, 53% of companies face supply chain attacks | global network security hotspot
Cloud development RMB 1 purchase activity is in progress
How to apply for trademark registration? What are the steps?
How much is a fortress machine? Why do you need a fortress machine?
Is it necessary to buy EIP? Price analysis of EIP
How to build glasses website what are the functions of glasses website construction
Hunan data security governance Summit Forum was held, and Tencent built the best practice of government enterprise data security
Dry goods how to build a data visualization project from scratch?
Why install code signing certificate to scan and eliminate virus software from security
Shopee Clickhouse cold and hot data separation storage architecture and Practice
What does cloud desktop mean? What are the characteristics of cloud desktop?
Grpc: how do I start multiple ports?
take the crown! Tencent security won the 2021 national network security week outstanding innovation achievement award
How does cloud computing achieve elastic scaling? What are the characteristics of elasticity?